[mutter] wayland: Update the CoglTexture in the MetaWaylandSurface
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland: Update the CoglTexture in the MetaWaylandSurface
- Date: Thu, 21 Aug 2014 21:22:37 +0000 (UTC)
commit f5580f61f97e865b3708085b35691c6139341422
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Aug 21 16:19:23 2014 -0400
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.
src/compositor/meta-surface-actor-wayland.c | 16 ----------------
src/compositor/meta-surface-actor-x11.c | 4 ----
src/compositor/meta-surface-actor.c | 6 +++++-
src/compositor/meta-surface-actor.h | 3 ---
src/wayland/meta-wayland-surface.c | 10 ++++++++++
5 files changed, 15 insertions(+), 24 deletions(-)
---
diff --git a/src/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c
index 31be26f..d1abedb 100644
--- a/src/compositor/meta-surface-actor-wayland.c
+++ b/src/compositor/meta-surface-actor-wayland.c
@@ -57,22 +57,6 @@ static void
meta_surface_actor_wayland_process_damage (MetaSurfaceActor *actor,
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
diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c
index 9322081..ac72fb7 100644
--- a/src/compositor/meta-surface-actor-x11.c
+++ b/src/compositor/meta-surface-actor-x11.c
@@ -185,11 +185,7 @@ damage_area (MetaSurfaceActorX11 *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);
- meta_surface_actor_update_area (META_SURFACE_ACTOR (self), x, y, width, height);
}
static void
diff --git a/src/compositor/meta-surface-actor.c b/src/compositor/meta-surface-actor.c
index d280c7a..7a13b77 100644
--- a/src/compositor/meta-surface-actor.c
+++ b/src/compositor/meta-surface-actor.c
@@ -188,7 +188,7 @@ meta_surface_actor_get_texture (MetaSurfaceActor *self)
return self->priv->texture;
}
-void
+static void
meta_surface_actor_update_area (MetaSurfaceActor *self,
int x, int y, int width, int height)
{
@@ -261,7 +261,11 @@ meta_surface_actor_process_damage (MetaSurfaceActor *self,
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_update_area (self, x, y, width, height);
}
void
diff --git a/src/compositor/meta-surface-actor.h b/src/compositor/meta-surface-actor.h
index e5f8286..489fa20 100644
--- a/src/compositor/meta-surface-actor.h
+++ b/src/compositor/meta-surface-actor.h
@@ -61,9 +61,6 @@ void meta_surface_actor_set_input_region (MetaSurfaceActor *self,
void meta_surface_actor_set_opaque_region (MetaSurfaceActor *self,
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,
int x, int y, int width, int height);
void meta_surface_actor_pre_paint (MetaSurfaceActor *actor);
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index d6f386d..eca1c84 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -109,11 +109,15 @@ surface_process_damage (MetaWaylandSurface *surface,
int i, n_rectangles;
cairo_rectangle_int_t buffer_rect;
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 */
if (!surface->buffer)
return;
+ texture = surface->buffer->texture;
+
buffer_rect.x = 0;
buffer_rect.y = 0;
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);
+ shm_buffer = wl_shm_buffer_get (surface->buffer->resource);
+
for (i = 0; i < n_rectangles; i++)
{
cairo_rectangle_int_t 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,
rect.x * scale, rect.y * scale, rect.width * scale, rect.height *
scale);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]