mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
wayland: Update the CoglTexture in the MetaWaylandSurface
It doesn't make sense to update it in the surface actor. It's also theoretically wrong to update the buffer's texture on surface commit, too, because it's buffer state, not surface state, but I don't think there's any place we use a wl_buffer without a wl_surface.
This commit is contained in:
parent
30953cf2d7
commit
f5580f61f9
@ -57,22 +57,6 @@ static void
|
|||||||
meta_surface_actor_wayland_process_damage (MetaSurfaceActor *actor,
|
meta_surface_actor_wayland_process_damage (MetaSurfaceActor *actor,
|
||||||
int x, int y, int width, int height)
|
int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
MetaSurfaceActorWayland *self = META_SURFACE_ACTOR_WAYLAND (actor);
|
|
||||||
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
|
|
||||||
|
|
||||||
if (priv->buffer)
|
|
||||||
{
|
|
||||||
struct wl_resource *resource = priv->buffer->resource;
|
|
||||||
struct wl_shm_buffer *shm_buffer = wl_shm_buffer_get (resource);
|
|
||||||
|
|
||||||
if (shm_buffer)
|
|
||||||
{
|
|
||||||
CoglTexture2D *texture = COGL_TEXTURE_2D (priv->buffer->texture);
|
|
||||||
cogl_wayland_texture_set_region_from_shm_buffer (texture, x, y, width, height, shm_buffer, x, y, 0, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_surface_actor_update_area (META_SURFACE_ACTOR (self), x, y, width, height);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -185,11 +185,7 @@ damage_area (MetaSurfaceActorX11 *self,
|
|||||||
{
|
{
|
||||||
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
|
||||||
|
|
||||||
if (!is_visible (self))
|
|
||||||
return;
|
|
||||||
|
|
||||||
cogl_texture_pixmap_x11_update_area (priv->texture, x, y, width, height);
|
cogl_texture_pixmap_x11_update_area (priv->texture, x, y, width, height);
|
||||||
meta_surface_actor_update_area (META_SURFACE_ACTOR (self), x, y, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -188,7 +188,7 @@ meta_surface_actor_get_texture (MetaSurfaceActor *self)
|
|||||||
return self->priv->texture;
|
return self->priv->texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
meta_surface_actor_update_area (MetaSurfaceActor *self,
|
meta_surface_actor_update_area (MetaSurfaceActor *self,
|
||||||
int x, int y, int width, int height)
|
int x, int y, int width, int height)
|
||||||
{
|
{
|
||||||
@ -261,7 +261,11 @@ meta_surface_actor_process_damage (MetaSurfaceActor *self,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!meta_surface_actor_is_visible (self))
|
||||||
|
return;
|
||||||
|
|
||||||
META_SURFACE_ACTOR_GET_CLASS (self)->process_damage (self, x, y, width, height);
|
META_SURFACE_ACTOR_GET_CLASS (self)->process_damage (self, x, y, width, height);
|
||||||
|
meta_surface_actor_update_area (self, x, y, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -61,9 +61,6 @@ void meta_surface_actor_set_input_region (MetaSurfaceActor *self,
|
|||||||
void meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
void meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
|
||||||
cairo_region_t *region);
|
cairo_region_t *region);
|
||||||
|
|
||||||
void meta_surface_actor_update_area (MetaSurfaceActor *actor,
|
|
||||||
int x, int y, int width, int height);
|
|
||||||
|
|
||||||
void meta_surface_actor_process_damage (MetaSurfaceActor *actor,
|
void meta_surface_actor_process_damage (MetaSurfaceActor *actor,
|
||||||
int x, int y, int width, int height);
|
int x, int y, int width, int height);
|
||||||
void meta_surface_actor_pre_paint (MetaSurfaceActor *actor);
|
void meta_surface_actor_pre_paint (MetaSurfaceActor *actor);
|
||||||
|
@ -109,11 +109,15 @@ surface_process_damage (MetaWaylandSurface *surface,
|
|||||||
int i, n_rectangles;
|
int i, n_rectangles;
|
||||||
cairo_rectangle_int_t buffer_rect;
|
cairo_rectangle_int_t buffer_rect;
|
||||||
int scale = surface->scale;
|
int scale = surface->scale;
|
||||||
|
CoglTexture *texture;
|
||||||
|
struct wl_shm_buffer *shm_buffer;
|
||||||
|
|
||||||
/* Damage without a buffer makes no sense so ignore that, otherwise we would crash */
|
/* Damage without a buffer makes no sense so ignore that, otherwise we would crash */
|
||||||
if (!surface->buffer)
|
if (!surface->buffer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
texture = surface->buffer->texture;
|
||||||
|
|
||||||
buffer_rect.x = 0;
|
buffer_rect.x = 0;
|
||||||
buffer_rect.y = 0;
|
buffer_rect.y = 0;
|
||||||
buffer_rect.width = cogl_texture_get_width (surface->buffer->texture);
|
buffer_rect.width = cogl_texture_get_width (surface->buffer->texture);
|
||||||
@ -125,10 +129,16 @@ surface_process_damage (MetaWaylandSurface *surface,
|
|||||||
|
|
||||||
n_rectangles = cairo_region_num_rectangles (region);
|
n_rectangles = cairo_region_num_rectangles (region);
|
||||||
|
|
||||||
|
shm_buffer = wl_shm_buffer_get (surface->buffer->resource);
|
||||||
|
|
||||||
for (i = 0; i < n_rectangles; i++)
|
for (i = 0; i < n_rectangles; i++)
|
||||||
{
|
{
|
||||||
cairo_rectangle_int_t rect;
|
cairo_rectangle_int_t rect;
|
||||||
cairo_region_get_rectangle (region, i, &rect);
|
cairo_region_get_rectangle (region, i, &rect);
|
||||||
|
|
||||||
|
if (shm_buffer)
|
||||||
|
cogl_wayland_texture_set_region_from_shm_buffer (texture, rect.x, rect.y, rect.width, rect.height, shm_buffer, rect.x, rect.y, 0, NULL);
|
||||||
|
|
||||||
meta_surface_actor_process_damage (surface->surface_actor,
|
meta_surface_actor_process_damage (surface->surface_actor,
|
||||||
rect.x * scale, rect.y * scale, rect.width * scale, rect.height * scale);
|
rect.x * scale, rect.y * scale, rect.width * scale, rect.height * scale);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user