[PATCH 2/5] pattern: Use pixman for EXTEND_PAD

Thomas Jaeger ThJaeger at gmail.com
Thu Feb 19 09:09:36 PST 2009


Pixman's EXTEND_PAD implementation used to be broken and has only been fixed
recently in 0.15.0.  This patch removes the ugly workaround that cairo has been
using to avoid the pixman code path.
---
 configure.ac        |    2 +-
 src/cairo-pattern.c |   94 ---------------------------------------------------
 2 files changed, 1 insertions(+), 95 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8afadcc..5856f59 100644
--- a/configure.ac
+++ b/configure.ac
@@ -450,7 +450,7 @@ CAIRO_ENABLE(test_surfaces, test surfaces, no)
 dnl ===========================================================================
 
 CAIRO_ENABLE_SURFACE_BACKEND(image, image, always, [
-  pixman_REQUIRES="pixman-1 >= 0.12.0"
+  pixman_REQUIRES="pixman-1 >= 0.15.0"
   PKG_CHECK_MODULES(pixman, $pixman_REQUIRES, , [AC_MSG_RESULT(no)
   use_image="no (requires $pixman_REQUIRES http://cairographics.org/releases/)"])
   image_REQUIRES=$pixman_REQUIRES
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 49187c4..69bb076 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1848,100 +1848,6 @@ _cairo_pattern_acquire_surface_for_surface (const cairo_surface_pattern_t   *pat
 	}
     }
 
-    /* XXX: Hack:
-     *
-     * The way we currently support CAIRO_EXTEND_REFLECT is to create
-     * an image twice bigger on each side, and create a pattern of four
-     * images such that the new image, when repeated, has the same effect
-     * of reflecting the original pattern.
-     */
-    if (attr->extend == CAIRO_EXTEND_REFLECT) {
-	cairo_t *cr;
-	cairo_surface_t *src;
-	int w, h;
-
-	status = _cairo_surface_get_extents (surface, &extents);
-	if (unlikely (status))
-	    goto BAIL;
-
-	status = _cairo_surface_clone_similar (dst, surface, content,
-					       extents.x, extents.y,
-					       extents.width, extents.height,
-					       &extents.x, &extents.y, &src);
-	if (unlikely (status))
-	    goto BAIL;
-
-	w = 2 * extents.width;
-	h = 2 * extents.height;
-
-	if (is_identity) {
-	    attr->x_offset = -x;
-	    x += tx;
-	    while (x <= -w)
-		x += w;
-	    while (x >= w)
-		x -= w;
-	    extents.x += x;
-	    tx = x = 0;
-
-	    attr->y_offset = -y;
-	    y += ty;
-	    while (y <= -h)
-		y += h;
-	    while (y >= h)
-		y -= h;
-	    extents.y += y;
-	    ty = y = 0;
-	}
-
-	cairo_surface_destroy (surface);
-	surface = cairo_surface_create_similar (dst, dst->content, w, h);
-	if (surface->status) {
-	    cairo_surface_destroy (src);
-	    return surface->status;
-	}
-
-	surface->device_transform = pattern->surface->device_transform;
-	surface->device_transform_inverse = pattern->surface->device_transform_inverse;
-
-	cr = cairo_create (surface);
-
-	cairo_set_source_surface (cr, src, -extents.x, -extents.y);
-	cairo_paint (cr);
-
-	cairo_scale (cr, -1, +1);
-	cairo_set_source_surface (cr, src, extents.x-w, -extents.y);
-	cairo_paint (cr);
-	cairo_set_source_surface (cr, src, extents.x, -extents.y);
-	cairo_paint (cr);
-
-	cairo_scale (cr, +1, -1);
-	cairo_set_source_surface (cr, src, extents.x-w, extents.y-h);
-	cairo_paint (cr);
-	cairo_set_source_surface (cr, src, extents.x, extents.y-h);
-	cairo_paint (cr);
-	cairo_set_source_surface (cr, src, extents.x-w, extents.y);
-	cairo_paint (cr);
-	cairo_set_source_surface (cr, src, extents.x, extents.y);
-	cairo_paint (cr);
-
-	cairo_scale (cr, -1, +1);
-	cairo_set_source_surface (cr, src, -extents.x, extents.y-h);
-	cairo_paint (cr);
-	cairo_set_source_surface (cr, src, -extents.x, extents.y);
-	cairo_paint (cr);
-
-	status = cairo_status (cr);
-	cairo_destroy (cr);
-
-	cairo_surface_destroy (src);
-
-	if (unlikely (status))
-	    goto BAIL;
-
-	attr->extend = CAIRO_EXTEND_REPEAT;
-    }
-
     status = _cairo_surface_get_extents (surface, &extents);
     if (unlikely (status))
 	goto BAIL;
-- 
1.6.3.1


--------------060006090906060701020708
Content-Type: text/x-patch;
 name="0003-xlib-Use-server-side-gradients-when-available.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename*0="0003-xlib-Use-server-side-gradients-when-available.patch"



More information about the cairo mailing list