[PATCH 2/4] xcb: Remove a duplicate static function

Uli Schlachter psychon at znc.in
Sun Jan 30 06:35:36 PST 2011


Both cairo-xcb-surface-core.c and cairo-xcb-surface-render.c contained an
identical definition of _cairo_xcb_shm_image_create. This commits removes the
one from cairo-xcb-surface-render.c.

Signed-off-by: Uli Schlachter <psychon at znc.in>
---
 src/cairo-xcb-private.h        |    7 ++++
 src/cairo-xcb-surface-core.c   |    2 +-
 src/cairo-xcb-surface-render.c |   61 ----------------------------------------
 3 files changed, 8 insertions(+), 62 deletions(-)

diff --git a/src/cairo-xcb-private.h b/src/cairo-xcb-private.h
index b6b25ce..0692f59 100644
--- a/src/cairo-xcb-private.h
+++ b/src/cairo-xcb-private.h
@@ -534,6 +534,13 @@ _cairo_xcb_connection_poly_fill_rectangle (cairo_xcb_connection_t *connection,
 					   xcb_rectangle_t *rectangles);
 
 #if CAIRO_HAS_XCB_SHM_FUNCTIONS
+cairo_private cairo_status_t
+_cairo_xcb_shm_image_create (cairo_xcb_connection_t *connection,
+			     pixman_format_code_t pixman_format,
+			     int width, int height,
+			     cairo_image_surface_t **image_out,
+			     cairo_xcb_shm_info_t **shm_info_out);
+
 cairo_private uint32_t
 _cairo_xcb_connection_shm_attach (cairo_xcb_connection_t *connection,
 				  uint32_t id,
diff --git a/src/cairo-xcb-surface-core.c b/src/cairo-xcb-surface-core.c
index b752a33..bcfb7a1 100644
--- a/src/cairo-xcb-surface-core.c
+++ b/src/cairo-xcb-surface-core.c
@@ -140,7 +140,7 @@ _cairo_xcb_pixmap_copy (cairo_xcb_surface_t *target)
     return surface;
 }
 
-static cairo_status_t
+cairo_status_t
 _cairo_xcb_shm_image_create (cairo_xcb_connection_t *connection,
 			     pixman_format_code_t pixman_format,
 			     int width, int height,
diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index 9a059fc..80cd016 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -727,67 +727,6 @@ _cairo_xcb_solid_picture (cairo_xcb_surface_t *target,
     return picture;
 }
 
-static cairo_status_t
-_cairo_xcb_shm_image_create (cairo_xcb_connection_t *connection,
-			     pixman_format_code_t pixman_format,
-			     int width, int height,
-			     cairo_image_surface_t **image_out,
-			     cairo_xcb_shm_info_t **shm_info_out)
-{
-    cairo_surface_t *image = NULL;
-    cairo_xcb_shm_info_t *shm_info = NULL;
-    cairo_status_t status;
-
-#if CAIRO_HAS_XCB_SHM_FUNCTIONS
-    if ((connection->flags & CAIRO_XCB_HAS_SHM)) {
-	size_t size, stride;
-
-	stride = CAIRO_STRIDE_FOR_WIDTH_BPP (width, PIXMAN_FORMAT_BPP (pixman_format));
-	size = stride * height;
-	if (size > CAIRO_XCB_SHM_SMALL_IMAGE) {
-	    status = _cairo_xcb_connection_allocate_shm_info (connection,
-							      size, &shm_info);
-	    if (unlikely (status))
-		return status;
-
-	    image = _cairo_image_surface_create_with_pixman_format (shm_info->mem,
-								    pixman_format,
-								    width, height,
-								    stride);
-	    status = image->status;
-	    if (unlikely (status)) {
-		_cairo_xcb_shm_info_destroy (shm_info);
-		return status;
-	    }
-
-	    status = _cairo_user_data_array_set_data (&image->user_data,
-						      (const cairo_user_data_key_t *) connection,
-						      shm_info,
-						      (cairo_destroy_func_t) _cairo_xcb_shm_info_destroy);
-	    if (unlikely (status)) {
-		cairo_surface_destroy (image);
-		_cairo_xcb_shm_info_destroy (shm_info);
-		return status;
-	    }
-	}
-    }
-#endif
-
-    if (image == NULL) {
-	image = _cairo_image_surface_create_with_pixman_format (NULL,
-								pixman_format,
-								width, height,
-								0);
-	status = image->status;
-	if (unlikely (status))
-	    return status;
-    }
-
-    *image_out = (cairo_image_surface_t *) image;
-    *shm_info_out = shm_info;
-    return CAIRO_STATUS_SUCCESS;
-}
-
 static cairo_xcb_picture_t *
 _render_to_picture (cairo_xcb_surface_t *target,
 		    const cairo_pattern_t *pattern,
-- 
1.7.2.3


--------------060000060309050604010504
Content-Type: text/x-diff;
 name="0003-xcb-Move-the-allocation-of-a-shm-surface-into-its-ow.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0003-xcb-Move-the-allocation-of-a-shm-surface-into-its-ow.pa";
 filename*1="tch"



More information about the cairo mailing list