From 5ef1020e8a33cc6e30a60cb472802f20c6db1245 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 28 Nov 2013 14:28:29 +0000 Subject: [PATCH] Revert "cogl-texture-2d: Add update_area equivalent for Wayland" This patch was accidentally added before it had any review and without first going through master. Master now has a replacement patch with some modifications. That will be cherry-picked to the 1.18 branch in a subsequent commit. This reverts commit af480a2b8b5450148ca4b969eec90ee330d5fd12. --- cogl/cogl-texture-2d.c | 87 +++++++++++--------------------------- cogl/cogl-wayland-server.h | 8 ---- 2 files changed, 25 insertions(+), 70 deletions(-) diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c index 174e141eb..bcbcc2907 100644 --- a/cogl/cogl-texture-2d.c +++ b/cogl/cogl-texture-2d.c @@ -293,66 +293,6 @@ _cogl_egl_texture_2d_new_from_image (CoglContext *ctx, #endif /* defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) */ #ifdef COGL_HAS_WAYLAND_EGL_SERVER_SUPPORT -static void -shm_buffer_get_cogl_pixel_format (struct wl_shm_buffer *shm_buffer, - CoglPixelFormat *format_out, - CoglPixelFormat *internal_format_out) -{ - CoglPixelFormat format; - CoglPixelFormat internal_format = COGL_PIXEL_FORMAT_ANY; - - 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; - internal_format = COGL_PIXEL_FORMAT_RGB_888; - 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; - internal_format = COGL_PIXEL_FORMAT_BGR_888; - break; -#endif - default: - g_warn_if_reached (); - format = COGL_PIXEL_FORMAT_ARGB_8888; - } - - if (format_out) - *format_out = format; - if (internal_format_out) - *internal_format_out = internal_format; -} - -void -cogl_wayland_texture_2d_update_area (CoglTexture2D *texture, - struct wl_shm_buffer *shm_buffer, - int x, - int y, - int width, - int height) -{ - CoglPixelFormat format; - - shm_buffer_get_cogl_pixel_format (shm_buffer, &format, NULL); - - cogl_texture_set_region (COGL_TEXTURE (texture), - x, y, - x, y, - width, height, - width, height, - format, - wl_shm_buffer_get_stride (shm_buffer), - wl_shm_buffer_get_data (shm_buffer)); -} - CoglTexture2D * cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx, struct wl_resource *buffer, @@ -365,11 +305,34 @@ cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx, if (shm_buffer) { int stride = wl_shm_buffer_get_stride (shm_buffer); + CoglPixelFormat format; + CoglPixelFormat internal_format = COGL_PIXEL_FORMAT_ANY; int width = wl_shm_buffer_get_width (shm_buffer); int height = wl_shm_buffer_get_height (shm_buffer); - CoglPixelFormat format, internal_format; - shm_buffer_get_cogl_pixel_format (shm_buffer, &format, &internal_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; + internal_format = COGL_PIXEL_FORMAT_RGB_888; + 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; + internal_format = COGL_PIXEL_FORMAT_BGR_888; + break; +#endif + default: + g_warn_if_reached (); + format = COGL_PIXEL_FORMAT_ARGB_8888; + } return cogl_texture_2d_new_from_data (ctx, width, height, diff --git a/cogl/cogl-wayland-server.h b/cogl/cogl-wayland-server.h index 39da86c55..7f008384c 100644 --- a/cogl/cogl-wayland-server.h +++ b/cogl/cogl-wayland-server.h @@ -95,14 +95,6 @@ cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx, struct wl_resource *buffer, CoglError **error); -void -cogl_wayland_texture_2d_update_area (CoglTexture2D *texture, - struct wl_shm_buffer *shm_buffer, - int x, - int y, - int width, - int height); - COGL_END_DECLS /* The gobject introspection scanner seems to parse public headers in