[mutter/wayland] shaped-texture: Use the cogl helper methods for fetching shm_buffer contents



commit 735b7361103484309bf60136a6a2c6443b37ac96
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Nov 14 15:41:59 2013 -0500

    shaped-texture: Use the cogl helper methods for fetching shm_buffer contents
    
    Rather than doing the set_region ourselves.

 src/compositor/meta-shaped-texture.c |   37 ++-------------------------------
 1 files changed, 3 insertions(+), 34 deletions(-)
---
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index 07b58a9..c1ac5ff 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -678,40 +678,9 @@ wayland_surface_update_area (MetaShapedTexture *stex,
       struct wl_shm_buffer *shm_buffer = wl_shm_buffer_get (resource);
 
       if (shm_buffer)
-        {
-          CoglPixelFormat format;
-
-          switch (wl_shm_buffer_get_format (shm_buffer))
-            {
-#if G_BYTE_ORDER == G_BIG_ENDIAN
-            case WL_SHM_FORMAT_ARGB8888:
-              format = COGL_PIXEL_FORMAT_ARGB_8888_PRE;
-              break;
-            case WL_SHM_FORMAT_XRGB8888:
-              format = COGL_PIXEL_FORMAT_ARGB_8888;
-              break;
-#elif G_BYTE_ORDER == G_LITTLE_ENDIAN
-            case WL_SHM_FORMAT_ARGB8888:
-              format = COGL_PIXEL_FORMAT_BGRA_8888_PRE;
-              break;
-            case WL_SHM_FORMAT_XRGB8888:
-              format = COGL_PIXEL_FORMAT_BGRA_8888;
-              break;
-#endif
-            default:
-              g_warn_if_reached ();
-              format = COGL_PIXEL_FORMAT_ARGB_8888;
-            }
-
-          cogl_texture_set_region (priv->texture,
-                                   x, y,
-                                   x, y,
-                                   width, height,
-                                   width, height,
-                                   format,
-                                   wl_shm_buffer_get_stride (shm_buffer),
-                                   wl_shm_buffer_get_data (shm_buffer));
-        }
+        cogl_wayland_texture_2d_update_area (COGL_TEXTURE_2D (priv->texture),
+                                             shm_buffer,
+                                             x, y, width, height);
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]