[cairo-commit] 19 commits - src/cairo-image-surface.c src/cairo-pattern.c src/cairo-pdf-surface.c src/cairo-ps-surface.c src/cairo-surface.c src/cairo-svg-surface.c test/extend-pad.c test/extend-pad-ref.png test/extend-reflect.c test/extend-reflect-ref.png test/.gitignore test/Makefile.am test/surface-pattern.c test/surface-pattern-pdf-argb32-ref.png test/surface-pattern-ps-argb32-ref.png test/surface-pattern-ref.png test/surface-pattern-svg-ref.png TODO

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Feb 23 14:37:32 PST 2007


 TODO                                    |   15 ++++-
 src/cairo-image-surface.c               |    1 
 src/cairo-pattern.c                     |   84 ++++++++++++++++++++++++++++
 src/cairo-pdf-surface.c                 |   19 +++++-
 src/cairo-ps-surface.c                  |   73 ++++++++++++++----------
 src/cairo-surface.c                     |   34 +----------
 src/cairo-svg-surface.c                 |   25 +++++---
 test/.gitignore                         |    1 
 test/Makefile.am                        |    8 ++
 test/extend-pad-ref.png                 |binary
 test/extend-pad.c                       |   74 +++++++++++++++++++++++++
 test/extend-reflect-ref.png             |binary
 test/extend-reflect.c                   |    6 --
 test/surface-pattern-pdf-argb32-ref.png |binary
 test/surface-pattern-ps-argb32-ref.png  |binary
 test/surface-pattern-ref.png            |binary
 test/surface-pattern-svg-ref.png        |binary
 test/surface-pattern.c                  |   94 ++++++++++++++------------------
 18 files changed, 301 insertions(+), 133 deletions(-)

New commits:
diff-tree 7185c00e15aecf14d1957ba2e4f386ecb4e2a635 (from aa3ebdbd01eb27e205b44728f9f5d9332c5ad450)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Feb 23 16:21:28 2007 -0500

    [PS] Add note about possible need for fix.

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index dcc74ba..b55900c 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1740,6 +1740,11 @@ emit_surface_pattern (cairo_ps_surface_t
 	 */
 	switch (pattern->base.extend) {
 	case CAIRO_EXTEND_NONE:
+	    /* XXX We may need to update this to something like the code
+	     * that is in PDF.  The point is, xstep/ystep are in pattern
+	     * space, not device space, so surface->width/height do not
+	     * make much sense.  But most of the time patterns scale up,
+	     * not down, so this is less of a problem. */
 	    xstep = MAX (image->width, surface->width);
 	    ystep = MAX (image->height, surface->height);
 	    break;
diff-tree aa3ebdbd01eb27e205b44728f9f5d9332c5ad450 (from 38b590d8b7f1f955653bca5cf4cceb723e173ade)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Feb 23 16:19:04 2007 -0500

    [TODO] More TODO items

diff --git a/TODO b/TODO
index cc82af6..4e99fc8 100644
--- a/TODO
+++ b/TODO
@@ -17,7 +17,7 @@ P	Add cairo_arc_to.
 	Add support for custom caps (see below for details)
 	Add CAIRO_STATUS_DESTROYED
 	Add cairo_finish
-	Add cairo_get_scaled_font
+See New Api below
 
 Details on some of the above changes
 ------------------------------------
@@ -41,6 +41,8 @@ Changes that do not affect the public AP
 
 * Fix/define tolerance for PS/PDF/SVG backends
 
+* Fix CAIRO_EXTEND_REFLECT in pixman and remove the current hack
+
 Other changes (this text used to be in RODMAP)
 ==============================================
  Fairly severe bugs
@@ -75,10 +77,17 @@ Other changes (this text used to be in R
      cairo_arc_to
 	see http://lists.freedesktop.org/archives/cairo/2005-August/004801.html
 	or see arc_to branch in bedhad's repository
-      User-font API---a couple of threads of interest:
+     cairo_font_options_[gs]et_writing_mode()
+	http://lists.freedesktop.org/archives/cairo/2007-January/009372.html
+     cairo_font_metrics_t
+	http://lists.freedesktop.org/archives/cairo/2007-January/009373.html
+     cairo_get_scaled_font()
+	http://lists.freedesktop.org/archives/cairo/2007-January/009374.html
+     User-font API---a couple of threads of interest:
+	http://lists.freedesktop.org/archives/cairo/2007-February/009539.html
         http://lists.freedesktop.org/archives/cairo/2006-May/006893.html
 	http://lists.freedesktop.org/archives/cairo/2006-May/006888.html
-      Polling API (cairo_get_serial and cairo_changed)
+     Polling API (cairo_get_serial and cairo_changed)
 
  PS/PDF improvements
      1. Make image fallbacks finer-grained than a whole page
diff-tree 38b590d8b7f1f955653bca5cf4cceb723e173ade (from 69edcd4623ae4e1ef16c5a8d16a5ebd0c79d685f)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Feb 23 16:18:00 2007 -0500

    [SVG] Fix warnings

diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 2da55e2..4a7cd24 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -928,7 +928,8 @@ emit_composite_image_pattern (cairo_outp
     cairo_status_t status;
     cairo_matrix_t p2u;
 
-    status = _cairo_pattern_acquire_surface (pattern, svg_surface,
+    status = _cairo_pattern_acquire_surface ((cairo_pattern_t *)pattern,
+					     (cairo_surface_t *)svg_surface,
 					     0, 0, -1, -1,
 					     &surface, &surface_attr);
     if (status)
@@ -971,7 +972,8 @@ emit_composite_image_pattern (cairo_outp
     if (pattern_id != invalid_pattern_id)
 	_cairo_output_stream_printf (output, "</pattern>\n");
 
-    _cairo_pattern_release_surface (pattern, surface, &surface_attr);
+    _cairo_pattern_release_surface ((cairo_pattern_t *)pattern,
+				    surface, &surface_attr);
 
     return status;
 }
diff-tree 69edcd4623ae4e1ef16c5a8d16a5ebd0c79d685f (from 11b3f43e927919a46909900a63386a1af788529a)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Feb 23 16:15:44 2007 -0500

    [SVG] Rename a local variable for clarity

diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 5c73f9e..2da55e2 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -922,19 +922,19 @@ emit_composite_image_pattern (cairo_outp
 			      int	 		 pattern_id,
 			      const char		*extra_attributes)
 {
-    cairo_surface_t *image;
-    cairo_surface_attributes_t image_attr;
+    cairo_surface_t *surface;
+    cairo_surface_attributes_t surface_attr;
     cairo_rectangle_int16_t extents;
     cairo_status_t status;
     cairo_matrix_t p2u;
 
     status = _cairo_pattern_acquire_surface (pattern, svg_surface,
 					     0, 0, -1, -1,
-					     &image, &image_attr);
+					     &surface, &surface_attr);
     if (status)
 	return status;
 
-    status = _cairo_surface_get_extents (image, &extents);
+    status = _cairo_surface_get_extents (surface, &extents);
 
     if (status)
 	return status;
@@ -964,14 +964,14 @@ emit_composite_image_pattern (cairo_outp
 
     _cairo_output_stream_printf (output, " xlink:href=\"");
 
-    status = _cairo_surface_base64_encode (image, output);
+    status = _cairo_surface_base64_encode (surface, output);
 
     _cairo_output_stream_printf (output, "\"/>\n");
 
     if (pattern_id != invalid_pattern_id)
 	_cairo_output_stream_printf (output, "</pattern>\n");
 
-    _cairo_pattern_release_surface (pattern, image, &image_attr);
+    _cairo_pattern_release_surface (pattern, surface, &surface_attr);
 
     return status;
 }
diff-tree 11b3f43e927919a46909900a63386a1af788529a (from 2d908e6a957c8b1e7f369621aaace2fc7277a941)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Feb 23 16:14:37 2007 -0500

    [TODO] Add various TODO items

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 1b5215f..6279012 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -1116,6 +1116,7 @@ _cairo_image_surface_clone (cairo_image_
 	cairo_image_surface_create (format,
 				    surface->width, surface->height);
 
+    /* Use _cairo_surface_composite directly */
     cr = cairo_create (&clone->base);
     cairo_surface_get_device_offset (&surface->base, &x, &y);
     cairo_set_source_surface (cr, &surface->base, x, y);
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 6dc699e..9d99976 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1430,6 +1430,7 @@ _cairo_pattern_acquire_surface_for_surfa
 	    (*out)->device_transform = pattern->surface->device_transform;
 	    (*out)->device_transform_inverse = pattern->surface->device_transform_inverse;
 
+	    /* XXX Use _cairo_surface_composite directly */
 	    cr = cairo_create (*out);
 
 	    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
diff-tree 2d908e6a957c8b1e7f369621aaace2fc7277a941 (from 289ac33fa28216cc6cc3e3d415cc4ff96cb17e12)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Feb 22 18:24:19 2007 -0500

    [test] Add a new, XFAIL, extend-pad test

diff --git a/test/.gitignore b/test/.gitignore
index 3bac973..6918015 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -37,6 +37,7 @@ dash-zero-length
 degenerate-path
 device-offset
 device-offset-positive
+extend-pad
 extend-reflect
 fallback-resolution
 fallback-resolution.pdf
diff --git a/test/Makefile.am b/test/Makefile.am
index b7fd095..162f607 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -31,6 +31,7 @@ dash-state			\
 degenerate-path			\
 device-offset			\
 device-offset-positive		\
+extend-pad			\
 extend-reflect			\
 fill-and-stroke			\
 fill-and-stroke-alpha		\
@@ -220,6 +221,7 @@ device-offset-ref.png					\
 device-offset-rgb24-ref.png				\
 device-offset-positive-ref.png				\
 device-offset-positive-rgb24-ref.png			\
+extend-pad-ref.png					\
 extend-reflect-ref.png					\
 fill-and-stroke-ref.png					\
 fill-and-stroke-rgb24-ref.png				\
@@ -362,6 +364,7 @@ zero-alpha-ref.png
 XFAIL_TESTS =			\
 a8-mask				\
 big-trap			\
+extend-pad			\
 filter-nearest-offset		\
 long-lines			\
 self-intersecting		\
diff --git a/test/extend-pad-ref.png b/test/extend-pad-ref.png
new file mode 100644
index 0000000..9292f8b
Binary files /dev/null and b/test/extend-pad-ref.png differ
diff --git a/test/extend-pad.c b/test/extend-pad.c
new file mode 100644
index 0000000..a59138e
--- /dev/null
+++ b/test/extend-pad.c
@@ -0,0 +1,74 @@
+#include <math.h>
+#include "cairo-test.h"
+#include <stdio.h>
+
+#define SIZE 90
+
+static cairo_test_draw_function_t draw;
+
+cairo_test_t test = {
+    "extend-pad",
+    "Test CAIRO_EXTEND_PAD for surface patterns",
+    SIZE, SIZE,
+    draw
+};
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+    cairo_surface_t *surface;
+    cairo_t * cr_surface;
+    int surface_size = (SIZE - 30) / 10;
+
+    cairo_set_source_rgba (cr, 0, 0, 0, 1);
+    cairo_rectangle (cr, 0, 0, SIZE, SIZE);
+    cairo_fill (cr);
+
+    /* Create an image surface with my favorite four colors in each
+     * quadrant. */
+    surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
+					  surface_size, surface_size);
+    cr_surface = cairo_create (surface);
+    cairo_set_source_rgb (cr_surface, 1, 1, 1);
+    cairo_rectangle (cr_surface,
+		     0, 0,
+		     surface_size / 2, surface_size / 2);
+    cairo_fill (cr_surface);
+    cairo_set_source_rgb (cr_surface, 1, 0, 0);
+    cairo_rectangle (cr_surface,
+		     surface_size / 2, 0,
+		     surface_size / 2, surface_size / 2);
+    cairo_fill (cr_surface);
+    cairo_set_source_rgb (cr_surface, 0, 1, 0);
+    cairo_rectangle (cr_surface,
+		     0, surface_size / 2,
+		     surface_size / 2, surface_size / 2);
+    cairo_fill (cr_surface);
+    cairo_set_source_rgb (cr_surface, 0, 0, 1);
+    cairo_rectangle (cr_surface,
+		     surface_size / 2, surface_size / 2,
+		     surface_size / 2, surface_size / 2);
+    cairo_fill (cr_surface);
+    cairo_destroy (cr_surface);
+
+    cairo_scale (cr, 10, 10);
+    cairo_set_source_surface (cr, surface, 1.5, 1.5);
+    cairo_surface_destroy (surface);
+
+    /* Using EXTEND_REFLECT makes this test pass for image and xlib backends */
+    /*cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REFLECT);*/
+
+    cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_PAD);
+    cairo_rectangle (cr, 1.5, 1.5, 6, 6);
+    cairo_clip (cr);
+
+    cairo_paint (cr);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+int
+main (void)
+{
+    return cairo_test (&test);
+}
diff-tree 289ac33fa28216cc6cc3e3d415cc4ff96cb17e12 (from 16013ced09c8d6e2a967b9192f8545716a423504)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Feb 22 18:23:10 2007 -0500

    [PS] Fix surface patterns with transforms
    
    Previously we were generating an image object with the desired
    transform and then a pattern with only a translation.  This means,
    the pattern was alwasys axis-aligned.  Obviously this does not
    work correctly with repeated rotated patterns.
    
    We now use an identity matrix for the image and put all the
    pattern transformation (well, it's inverse) into the pattern.
    This fixes the issue nicely.
    
    The surface-pattern test is still failing even with a reference
    image, because the gs rendering of the normal case and the
    device-offset=25 case are different and both have seams.

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 6e71842..dcc74ba 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1554,7 +1554,6 @@ _string_array_stream_create (cairo_outpu
 static cairo_status_t
 emit_image (cairo_ps_surface_t    *surface,
 	    cairo_image_surface_t *image,
-	    cairo_matrix_t	  *matrix,
 	    const char		  *name)
 {
     cairo_status_t status;
@@ -1663,17 +1662,14 @@ emit_image (cairo_ps_surface_t    *surfa
 				 "	    /%sDataIndex %sDataIndex 1 add def\n"
 				 "	    %sDataIndex %sData length 1 sub gt { /%sDataIndex 0 def } if\n"
 				 "	} /ASCII85Decode filter /LZWDecode filter\n"
-				 "	/ImageMatrix [ %f %f %f %f %f %f ]\n"
+				 "	/ImageMatrix [ 1 0 0 1 0 0 ]\n"
 				 "    >>\n"
 				 "    image\n"
 				 "} def\n",
 				 name,
 				 opaque_image->width,
 				 opaque_image->height,
-				 name, name, name, name, name, name, name,
-				 matrix->xx, matrix->yx,
-				 matrix->xy, matrix->yy,
-				 0.0, 0.0);
+				 name, name, name, name, name, name, name);
 
     status = CAIRO_STATUS_SUCCESS;
 
@@ -1707,23 +1703,17 @@ static void
 emit_surface_pattern (cairo_ps_surface_t *surface,
 		      cairo_surface_pattern_t *pattern)
 {
-    double x_off, y_off;
-    double bbox_x1, bbox_y1, bbox_x2, bbox_y2;
+    double bbox_width, bbox_height;
     int xstep, ystep;
     cairo_matrix_t inverse = pattern->base.matrix;
 
     cairo_matrix_invert (&inverse);
-    x_off = inverse.x0;
-    y_off = inverse.y0;
-    inverse.x0 = inverse.y0 = 0.;
 
     if (_cairo_surface_is_meta (pattern->surface)) {
 	_cairo_output_stream_printf (surface->stream, "/MyPattern {\n");
 	_cairo_meta_surface_replay (pattern->surface, &surface->base);
-	/* XXX: shouldn't we transform bbox and other stuff here too? */
-	bbox_x1 = bbox_y1 = 0.;
-	bbox_x2 = surface->width;
-	bbox_y2 = surface->height;
+	bbox_width = surface->width;
+	bbox_height = surface->height;
 	xstep = surface->width;
 	ystep = surface->height;
 	_cairo_output_stream_printf (surface->stream, "} bind def\n");
@@ -1737,15 +1727,10 @@ emit_surface_pattern (cairo_ps_surface_t
 						      &image_extra);
 	assert (status == CAIRO_STATUS_SUCCESS);
 
-	emit_image (surface, image, &pattern->base.matrix, "MyPattern");
+	emit_image (surface, image, "MyPattern");
 
-	bbox_x1 = bbox_y1 = 0;
-	bbox_x2 = image->width;
-	bbox_y2 = image->height;
-	_cairo_matrix_transform_bounding_box (&inverse,
-					      &bbox_x1, &bbox_y1,
-					      &bbox_x2, &bbox_y2,
-					      NULL);
+	bbox_width = image->width;
+	bbox_height = image->height;
 
 	/* In PostScript, (as far as I can tell), all patterns are
 	 * repeating. So we support cairo's EXTEND_NONE semantics by
@@ -1779,10 +1764,9 @@ emit_surface_pattern (cairo_ps_surface_t
 				 "<< /PatternType 1\n"
 				 "   /PaintType 1\n"
 				 "   /TilingType 1\n");
-    /* XXX: should we floor/ceil here? */
     _cairo_output_stream_printf (surface->stream,
-				 "   /BBox [%f %f %f %f]\n",
-				 bbox_x1, bbox_y1, bbox_x2, bbox_y2);
+				 "   /BBox [0 0 %f %f]\n",
+				 bbox_width, bbox_height);
     _cairo_output_stream_printf (surface->stream,
 				 "   /XStep %d /YStep %d\n",
 				 xstep, ystep);
@@ -1790,8 +1774,10 @@ emit_surface_pattern (cairo_ps_surface_t
 				 "   /PaintProc { MyPattern } bind\n"
 				 ">>\n");
     _cairo_output_stream_printf (surface->stream,
-				 "[ 1 0 0 1 %f %f ]\n",
-				 x_off, y_off);
+				 "[ %f %f %f %f %f %f ]\n",
+				 inverse.xx, inverse.yx,
+				 inverse.xy, inverse.yy,
+				 inverse.x0, inverse.y0);
     _cairo_output_stream_printf (surface->stream,
 				 "makepattern setpattern\n");
 }
diff --git a/test/surface-pattern-ps-argb32-ref.png b/test/surface-pattern-ps-argb32-ref.png
new file mode 100644
index 0000000..2ec3a53
Binary files /dev/null and b/test/surface-pattern-ps-argb32-ref.png differ
diff-tree 16013ced09c8d6e2a967b9192f8545716a423504 (from c87edd9e10c2a60e11c8cd954860fb03f6425132)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Feb 22 18:07:22 2007 -0500

    [test] Remove non-existing test extend-pad

diff --git a/test/Makefile.am b/test/Makefile.am
index dc2739e..b7fd095 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -31,7 +31,6 @@ dash-state			\
 degenerate-path			\
 device-offset			\
 device-offset-positive		\
-extend-pad			\
 extend-reflect			\
 fill-and-stroke			\
 fill-and-stroke-alpha		\
@@ -322,6 +321,9 @@ source-clip-scale-svg-ref.png				\
 source-surface-scale-paint-ref.png			\
 source-surface-scale-paint-rgb24-ref.png		\
 surface-pattern-ref.png					\
+surface-pattern-pdf-argb32-ref.png			\
+surface-pattern-ps-argb32-ref.png			\
+surface-pattern-svg-ref.png				\
 text-antialias-gray-ref.png				\
 text-antialias-none-ref.png				\
 text-antialias-subpixel-ref.png				\
diff-tree c87edd9e10c2a60e11c8cd954860fb03f6425132 (from 7c39276366f91de151c775fa8293783f39247896)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Feb 22 16:03:47 2007 -0500

    [test] Update surface-pattern test to include transformations
    
    The surface-pattern test was very naive, painting a surface pattern
    repeated at identity size.  With the new test, the surface pattern
    is scaled and rotated.  This reveals a serious bug in the PS backend.

diff --git a/test/surface-pattern-pdf-argb32-ref.png b/test/surface-pattern-pdf-argb32-ref.png
new file mode 100644
index 0000000..699b220
Binary files /dev/null and b/test/surface-pattern-pdf-argb32-ref.png differ
diff --git a/test/surface-pattern-ref.png b/test/surface-pattern-ref.png
index 1a64106..d1c2b33 100644
Binary files a/test/surface-pattern-ref.png and b/test/surface-pattern-ref.png differ
diff --git a/test/surface-pattern-svg-ref.png b/test/surface-pattern-svg-ref.png
new file mode 100644
index 0000000..5569a55
Binary files /dev/null and b/test/surface-pattern-svg-ref.png differ
diff --git a/test/surface-pattern.c b/test/surface-pattern.c
index 8fe40e6..42aca27 100644
--- a/test/surface-pattern.c
+++ b/test/surface-pattern.c
@@ -1,36 +1,15 @@
-/*
- * Copyright © 2005 Red Hat, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Red Hat, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior
- * permission. Red Hat, Inc. makes no representations about the
- * suitability of this software for any purpose.  It is provided "as
- * is" without express or implied warranty.
- *
- * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Carl D. Worth <cworth at cworth.org>
- */
-
+#include <math.h>
 #include "cairo-test.h"
+#include <stdio.h>
+
+#define SIZE 140
 
 static cairo_test_draw_function_t draw;
 
 cairo_test_t test = {
     "surface-pattern",
-    "Tests use of a surface pattern",
-    36, 36,
+    "Test transformed repeated surface patterns",
+    SIZE, SIZE,
     draw
 };
 
@@ -38,35 +17,48 @@ static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
 {
     cairo_surface_t *surface;
-    cairo_t *cr2;
-    cairo_pattern_t *pattern;
-    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
-					  6, 6);
-
-    cr2 = cairo_create (surface);
-    {
-	cairo_rectangle (cr2, 0, 0, 3, 3);
-	cairo_rectangle (cr2, 3, 3, 3, 3);
-	cairo_set_source_rgb (cr2, 1, 1, 0);
-	cairo_fill (cr2);
-
-	cairo_rectangle (cr2, 3, 0, 3, 3);
-	cairo_rectangle (cr2, 0, 3, 3, 3);
-	cairo_set_source_rgb (cr2, 0, 0, 1);
-	cairo_fill (cr2);
-    }
-    cairo_destroy (cr2);
-
-    pattern = cairo_pattern_create_for_surface (surface);
-    cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
-    cairo_set_source (cr, pattern);
+    cairo_t * cr_surface;
+    int surface_size = 6;
 
-    cairo_rectangle (cr, 0, 0, width, height);
+    cairo_set_source_rgb (cr, 0, 0, 0);
+    cairo_rectangle (cr, 0, 0, SIZE, SIZE);
     cairo_fill (cr);
 
-    cairo_pattern_destroy (pattern);
+    /* Create an image surface with my favorite four colors in each
+     * quadrant. */
+    surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
+					  surface_size, surface_size);
+    cr_surface = cairo_create (surface);
+    cairo_set_source_rgb (cr_surface, 1, 1, 1);
+    cairo_rectangle (cr_surface,
+		     0, 0,
+		     surface_size / 2, surface_size / 2);
+    cairo_fill (cr_surface);
+    cairo_set_source_rgb (cr_surface, 1, 0, 0);
+    cairo_rectangle (cr_surface,
+		     surface_size / 2, 0,
+		     surface_size / 2, surface_size / 2);
+    cairo_fill (cr_surface);
+    cairo_set_source_rgb (cr_surface, 0, 1, 0);
+    cairo_rectangle (cr_surface,
+		     0, surface_size / 2,
+		     surface_size / 2, surface_size / 2);
+    cairo_fill (cr_surface);
+    cairo_set_source_rgb (cr_surface, 0, 0, 1);
+    cairo_rectangle (cr_surface,
+		     surface_size / 2, surface_size / 2,
+		     surface_size / 2, surface_size / 2);
+    cairo_fill (cr_surface);
+    cairo_destroy (cr_surface);
+
+    cairo_scale (cr, 10, 10);
+    cairo_rotate (cr, 1.);
+    cairo_set_source_surface (cr, surface, 1.5, 1.5);
     cairo_surface_destroy (surface);
 
+    cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
+    cairo_paint (cr);
+
     return CAIRO_TEST_SUCCESS;
 }
 
diff-tree 7c39276366f91de151c775fa8293783f39247896 (from 3405fb870e520bcc5588602317693837b59d1ee4)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Feb 22 13:40:55 2007 -0500

    [PS/PDF] Accept CAIRO_EXTEND_REFLECT surface patterns natively
    
    With the hack in _cairo_pattern_acquire_surface to return a 2x2
    surface for reflected patterns, we can now accept REFLECT surface
    patterns natively in all backends.  SVG was already doing that.
    The PDF case needed some changes to go through
    _cairo_pattern_acquire_surface.  A similar change to the recent
    change in SVG.

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index fa6c830..3b8830d 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -870,6 +870,8 @@ emit_surface_pattern (cairo_pdf_surface_
 		      cairo_surface_pattern_t	*pattern)
 {
     cairo_pdf_resource_t stream;
+    cairo_surface_t *pat_surface;
+    cairo_surface_attributes_t pat_attr;
     cairo_image_surface_t *image;
     void *image_extra;
     cairo_status_t status = CAIRO_STATUS_SUCCESS;
@@ -883,10 +885,17 @@ emit_surface_pattern (cairo_pdf_surface_
 
     _cairo_pdf_surface_pause_content_stream (surface);
 
-    status = _cairo_surface_acquire_source_image (pattern->surface, &image, &image_extra);
+    status = _cairo_pattern_acquire_surface ((cairo_pattern_t *)pattern,
+					     (cairo_surface_t *)surface,
+					     0, 0, -1, -1,
+					     &pat_surface, &pat_attr);
     if (status)
 	return status;
 
+    status = _cairo_surface_acquire_source_image (pat_surface, &image, &image_extra);
+    if (status)
+	goto BAIL2;
+
     status = emit_image (surface, image, &image_resource);
     if (status)
 	goto BAIL;
@@ -929,12 +938,12 @@ emit_surface_pattern (cairo_pdf_surface_
 	}
 	break;
     case CAIRO_EXTEND_REPEAT:
+    case CAIRO_EXTEND_REFLECT:
 	xstep = image->width;
 	ystep = image->height;
 	break;
     /* All the rest should have been analyzed away, so this case
      * should be unreachable. */
-    case CAIRO_EXTEND_REFLECT:
     case CAIRO_EXTEND_PAD:
     default:
 	ASSERT_NOT_REACHED;
@@ -1018,7 +1027,9 @@ emit_surface_pattern (cairo_pdf_surface_
 				 stream.id, stream.id, alpha.id);
 
  BAIL:
-    _cairo_surface_release_source_image (pattern->surface, image, image_extra);
+    _cairo_surface_release_source_image (pat_surface, image, image_extra);
+ BAIL2:
+    _cairo_pattern_release_surface ((cairo_pattern_t *)pattern, pat_surface, &pat_attr);
 
     return status;
 }
@@ -2559,8 +2570,8 @@ _surface_pattern_supported (cairo_surfac
     switch (extend) {
     case CAIRO_EXTEND_NONE:
     case CAIRO_EXTEND_REPEAT:
-	return TRUE;
     case CAIRO_EXTEND_REFLECT:
+	return TRUE;
     case CAIRO_EXTEND_PAD:
 	return FALSE;
     }
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 7306f4c..6e71842 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1355,8 +1355,8 @@ surface_pattern_supported (const cairo_s
     switch (extend) {
     case CAIRO_EXTEND_NONE:
     case CAIRO_EXTEND_REPEAT:
-	return TRUE;
     case CAIRO_EXTEND_REFLECT:
+	return TRUE;
     case CAIRO_EXTEND_PAD:
 	return FALSE;
     }
@@ -1759,12 +1759,12 @@ emit_surface_pattern (cairo_ps_surface_t
 	    ystep = MAX (image->height, surface->height);
 	    break;
 	case CAIRO_EXTEND_REPEAT:
+	case CAIRO_EXTEND_REFLECT:
 	    xstep = image->width;
 	    ystep = image->height;
 	    break;
 	/* All the rest should have been analyzed away, so these cases
 	 * should be unreachable. */
-	case CAIRO_EXTEND_REFLECT:
 	case CAIRO_EXTEND_PAD:
 	default:
 	    ASSERT_NOT_REACHED;
diff-tree 3405fb870e520bcc5588602317693837b59d1ee4 (from 63c011bb6bcbe484915b5bb28da087b14bd572a6)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Feb 22 13:10:34 2007 -0500

    [test] Increase size of extend-reflect test to see that pattern repeats

diff --git a/test/Makefile.am b/test/Makefile.am
index 0ce55aa..dc2739e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -31,6 +31,7 @@ dash-state			\
 degenerate-path			\
 device-offset			\
 device-offset-positive		\
+extend-pad			\
 extend-reflect			\
 fill-and-stroke			\
 fill-and-stroke-alpha		\
diff --git a/test/extend-reflect-ref.png b/test/extend-reflect-ref.png
index 6e22d5d..face8b5 100644
Binary files a/test/extend-reflect-ref.png and b/test/extend-reflect-ref.png differ
diff --git a/test/extend-reflect.c b/test/extend-reflect.c
index 3d36bb2..f9d2c4f 100644
--- a/test/extend-reflect.c
+++ b/test/extend-reflect.c
@@ -2,7 +2,7 @@
 #include "cairo-test.h"
 #include <stdio.h>
 
-#define SIZE 400
+#define SIZE 600
 const char	png_filename[]	= "romedalen.png";
 
 static cairo_test_draw_function_t draw;
diff-tree 63c011bb6bcbe484915b5bb28da087b14bd572a6 (from 3516d8092b6297b8e4a3919c09e47f2bd4dd600a)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Feb 21 18:29:25 2007 -0500

    [surface] Copy device_transform_inverse in _cairo_surface_clone_similar

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 5ea278f..7647db7 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1001,8 +1001,10 @@ _cairo_surface_clone_similar (cairo_surf
 
     status = surface->backend->clone_similar (surface, &image->base, src_x,
 					      src_y, width, height, clone_out);
-    if (status == CAIRO_STATUS_SUCCESS)
+    if (status == CAIRO_STATUS_SUCCESS) {
         (*clone_out)->device_transform = src->device_transform;
+        (*clone_out)->device_transform_inverse = src->device_transform_inverse;
+    }
 
     /* If the above failed point, we could implement a full fallback
      * using acquire_dest_image, but that's going to be very
diff-tree 3516d8092b6297b8e4a3919c09e47f2bd4dd600a (from 8d812ae9a670b2eeff4f0508e2c8c082e7900a7c)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Feb 21 18:13:16 2007 -0500

    [SVG] Use _cairo_pattern_acquire_surface instead of _cairo_surface_acquire_source_image
    
    This change is required for the upcoming hack to support
    CAIRO_EXTEND_REFLECT.  In short, the idea is that the surface returned
    by _cairo_pattern_acquire_surface may look different from the one
    returned by _cairo_surface_acquire_source_image, to support some pattern
    modes not supported by the backends directly.

diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 1788a99..5c73f9e 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -922,13 +922,20 @@ emit_composite_image_pattern (cairo_outp
 			      int	 		 pattern_id,
 			      const char		*extra_attributes)
 {
-    cairo_image_surface_t *image;
+    cairo_surface_t *image;
+    cairo_surface_attributes_t image_attr;
+    cairo_rectangle_int16_t extents;
     cairo_status_t status;
     cairo_matrix_t p2u;
-    void *image_extra;
 
-    status = _cairo_surface_acquire_source_image (pattern->surface,
-						  &image, &image_extra);
+    status = _cairo_pattern_acquire_surface (pattern, svg_surface,
+					     0, 0, -1, -1,
+					     &image, &image_attr);
+    if (status)
+	return status;
+
+    status = _cairo_surface_get_extents (image, &extents);
+
     if (status)
 	return status;
 
@@ -941,13 +948,13 @@ emit_composite_image_pattern (cairo_outp
 				     "patternUnits=\"userSpaceOnUse\" "
 				     "width=\"%d\" height=\"%d\"",
 				     pattern_id,
-				     image->width, image->height);
+				     extents.width, extents.height);
 	emit_transform (output, " patternTransform", ">\n", &p2u);
     }
 
     _cairo_output_stream_printf (output,
 				 "  <image width=\"%d\" height=\"%d\"",
-				 image->width, image->height);
+				 extents.width, extents.height);
 
     if (pattern_id == invalid_pattern_id)
 	emit_transform (output, " transform", "", &p2u);
@@ -957,14 +964,14 @@ emit_composite_image_pattern (cairo_outp
 
     _cairo_output_stream_printf (output, " xlink:href=\"");
 
-    status = _cairo_surface_base64_encode (pattern->surface, output);
+    status = _cairo_surface_base64_encode (image, output);
 
     _cairo_output_stream_printf (output, "\"/>\n");
 
     if (pattern_id != invalid_pattern_id)
 	_cairo_output_stream_printf (output, "</pattern>\n");
 
-    _cairo_surface_release_source_image (pattern->surface, image, image_extra);
+    _cairo_pattern_release_surface (pattern, image, &image_attr);
 
     return status;
 }
diff-tree 8d812ae9a670b2eeff4f0508e2c8c082e7900a7c (from 7cbfb9556d869310c48c106a9929c292110685ce)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Feb 22 14:13:33 2007 -0500

    [cairo-pattern] Correctly delegate device_transform so tests pass again

diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 3d3d587..6dc699e 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1331,6 +1331,9 @@ _cairo_pattern_acquire_surface_for_surfa
 	if (!*out)
 	    return CAIRO_STATUS_NO_MEMORY;
 
+	(*out)->device_transform = pattern->surface->device_transform;
+	(*out)->device_transform_inverse = pattern->surface->device_transform_inverse;
+
 	cr = cairo_create (*out);
 
 	cairo_set_source_surface (cr, pattern->surface, -x, -y);
@@ -1424,8 +1427,12 @@ _cairo_pattern_acquire_surface_for_surfa
 	    if (!*out)
 		return CAIRO_STATUS_NO_MEMORY;
 
+	    (*out)->device_transform = pattern->surface->device_transform;
+	    (*out)->device_transform_inverse = pattern->surface->device_transform_inverse;
+
 	    cr = cairo_create (*out);
 
+	    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
 	    cairo_set_source_surface (cr, pattern->surface, -x, -y);
 	    cairo_paint (cr);
 
diff-tree 7cbfb9556d869310c48c106a9929c292110685ce (from 5562050bcf68923986b597f3aca1e285a466fa6c)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Feb 22 12:56:05 2007 -0500

    [cairo-pattern] Fall back on cairo_surface_create_similar in _cairo_pattern_acquire_surface_for_surface
    
    This was needed for SVG backend because it does not implement clone_similar.
    However, I'm worried about possible infinite recursion here.  Not sure what
    to do.

diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index c695283..3d3d587 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1414,6 +1414,24 @@ _cairo_pattern_acquire_surface_for_surfa
 
 	status = _cairo_surface_clone_similar (dst, pattern->surface,
 					       x, y, width, height, out);
+
+	if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
+
+	    cairo_t *cr;
+
+	    *out = cairo_surface_create_similar (dst, dst->content,
+						 width, height);
+	    if (!*out)
+		return CAIRO_STATUS_NO_MEMORY;
+
+	    cr = cairo_create (*out);
+
+	    cairo_set_source_surface (cr, pattern->surface, -x, -y);
+	    cairo_paint (cr);
+
+	    status = cairo_status (cr);
+	    cairo_destroy (cr);
+	}
     }
 
     return status;
diff-tree 5562050bcf68923986b597f3aca1e285a466fa6c (from 81935bb13120898a8581d8266041d3292558710a)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Feb 21 18:16:34 2007 -0500

    Support CAIRO_EXTEND_REFLECT on surface patterns
    
    We do this through a hack, that is, we make
    _cairo_pattern_acquire_surface to return a surface that has four
    copies of the original surface painted such that this image can
    be simply repeated to get the effect of reflecting the original
    surface.
    
    This fixes the formerly XFAIL test extend-reflect.

diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 0c428ba..c695283 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1300,6 +1300,60 @@ _cairo_pattern_acquire_surface_for_surfa
 	ty = 0;
     }
 
+    /* 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.
+     *
+     * This is because the reflect support in pixman is broken and we
+     * pass repeat instead of reflect to pixman.  See
+     * _cairo_image_surface_set_attributes() for that.
+     */
+    if (attr->extend == CAIRO_EXTEND_REFLECT) {
+	cairo_t *cr;
+	int w,h;
+
+	cairo_rectangle_int16_t extents;
+	status = _cairo_surface_get_extents (pattern->surface, &extents);
+	if (status)
+	    return status;
+
+	attr->extend = CAIRO_EXTEND_REPEAT;
+
+	x = extents.x;
+	y = extents.y;
+	w = 2 * extents.width;
+	h = 2 * extents.height;
+
+	*out = cairo_surface_create_similar (dst, dst->content, w, h);
+	if (!*out)
+	    return CAIRO_STATUS_NO_MEMORY;
+
+	cr = cairo_create (*out);
+
+	cairo_set_source_surface (cr, pattern->surface, -x, -y);
+	cairo_paint (cr);
+
+	cairo_scale (cr, -1, +1);
+	cairo_set_source_surface (cr, pattern->surface, x-w, -y);
+	cairo_paint (cr);
+
+	cairo_scale (cr, +1, -1);
+	cairo_set_source_surface (cr, pattern->surface, x-w, y-h);
+	cairo_paint (cr);
+
+	cairo_scale (cr, -1, +1);
+	cairo_set_source_surface (cr, pattern->surface, -x, y-h);
+	cairo_paint (cr);
+
+	status = cairo_status (cr);
+	cairo_destroy (cr);
+
+	return status;
+    }
+
     if (_cairo_surface_is_image (dst))
     {
 	cairo_image_surface_t *image;
@@ -1321,7 +1375,9 @@ _cairo_pattern_acquire_surface_for_surfa
 	    return status;
 
 	/* If we're repeating, we just play it safe and clone the entire surface. */
-	if (attr->extend == CAIRO_EXTEND_REPEAT) {
+	/* If requested width and height are -1, clone the entire surface.
+	 * This is relied on in the svg backend. */
+	if (attr->extend == CAIRO_EXTEND_REPEAT || (width == -1 && height == -1)) {
 	    x = extents.x;
 	    y = extents.y;
 	    width = extents.width;
diff --git a/test/Makefile.am b/test/Makefile.am
index 3382cf4..0ce55aa 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -220,6 +220,7 @@ device-offset-ref.png					\
 device-offset-rgb24-ref.png				\
 device-offset-positive-ref.png				\
 device-offset-positive-rgb24-ref.png			\
+extend-reflect-ref.png					\
 fill-and-stroke-ref.png					\
 fill-and-stroke-rgb24-ref.png				\
 fill-and-stroke-ps-argb32-ref.png			\
@@ -358,7 +359,6 @@ zero-alpha-ref.png
 XFAIL_TESTS =			\
 a8-mask				\
 big-trap			\
-extend-reflect			\
 filter-nearest-offset		\
 long-lines			\
 self-intersecting		\
diff --git a/test/extend-reflect-ref.png b/test/extend-reflect-ref.png
index 7645362..6e22d5d 100644
Binary files a/test/extend-reflect-ref.png and b/test/extend-reflect-ref.png differ
diff --git a/test/extend-reflect.c b/test/extend-reflect.c
index 297c475..3d36bb2 100644
--- a/test/extend-reflect.c
+++ b/test/extend-reflect.c
@@ -3,15 +3,13 @@
 #include <stdio.h>
 
 #define SIZE 400
-#define OFFSET 50
 const char	png_filename[]	= "romedalen.png";
 
 static cairo_test_draw_function_t draw;
 
 cairo_test_t test = {
     "extend-reflect",
-    "Test CAIRO_EXTEND_REFLECT for surface patterns"
-    "\nCAIRO_EXTEND_REFLECT code is broken and corrupts memory",
+    "Test CAIRO_EXTEND_REFLECT for surface patterns",
     SIZE, SIZE,
     draw
 };
diff-tree 81935bb13120898a8581d8266041d3292558710a (from 4e30919f30e7618dbb62d7de2931efaac26c1785)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Feb 21 18:06:02 2007 -0500

    [PS] Update surface_pattern_supported() from PDF
    
    The PS backend was accepting all surface patterns, just to ASSERT_NOT_REACHED
    later if extend type of the pattern was PAD or REFLECT.  That didn't make
    sense and was causing crash for PAD (surprisingly not for REFLECT.  Not sure
    why).  So now it rejects those types of surface patterns, just like the PDF
    surface does.

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index ce98eb1..7306f4c 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1337,9 +1337,31 @@ color_is_gray (cairo_color_t *color)
 static cairo_bool_t
 surface_pattern_supported (const cairo_surface_pattern_t *pattern)
 {
-    if (pattern->surface->backend->acquire_source_image != NULL)
+    cairo_extend_t extend;
+
+    if (pattern->surface->backend->acquire_source_image == NULL)
+	return FALSE;
+
+    /* Does an ALPHA-only source surface even make sense? Maybe, but I
+     * don't think it's worth the extra code to support it. */
+
+/* XXX: Need to write this function here...
+    content = cairo_surface_get_content (pattern->surface);
+    if (content == CAIRO_CONTENT_ALPHA)
+	return FALSE;
+*/
+
+    extend = cairo_pattern_get_extend (&pattern->base);
+    switch (extend) {
+    case CAIRO_EXTEND_NONE:
+    case CAIRO_EXTEND_REPEAT:
 	return TRUE;
+    case CAIRO_EXTEND_REFLECT:
+    case CAIRO_EXTEND_PAD:
+	return FALSE;
+    }
 
+    ASSERT_NOT_REACHED;
     return FALSE;
 }
 
diff-tree 4e30919f30e7618dbb62d7de2931efaac26c1785 (from a57bc6b6973a270ef85d73089ebd9d10b3bc5aa8)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Feb 21 18:03:52 2007 -0500

    [cairo-surface] Do not err on CAIRO_EXTEND_PAD and CAIRO_EXTEND_REFLECT
    
    for surface patterns.
    
    Right before releasing cairo 1.2, Carl and I decided to return error on
    CAIRO_EXTEND_PAD and CAIRO_EXTEND_REFLECT for surface patterns, as they
    are not implemented and one was causing crashes.  Well, that was probably
    the worst decision we could make (other than ignoring the problem).  A
    much better decision would have been to make them act like
    CAIRO_EXTEND_NONE and CAIRO_EXTEND_REPEAT respectively.  Anyway, remove
    the error paths.

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 1224081..5ea278f 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1267,12 +1267,6 @@ _cairo_surface_paint (cairo_surface_t	*s
 
     assert (! surface->is_snapshot);
 
-    if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
-	(source->extend == CAIRO_EXTEND_REFLECT || source->extend == CAIRO_EXTEND_PAD))
-    {
-        return CAIRO_STATUS_NO_MEMORY;
-    }
-
     _cairo_surface_copy_pattern_for_destination (source, surface, &dev_source.base);
 
     if (surface->backend->paint) {
@@ -1301,12 +1295,6 @@ _cairo_surface_mask (cairo_surface_t	*su
 
     assert (! surface->is_snapshot);
 
-    if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
-	(source->extend == CAIRO_EXTEND_REFLECT || source->extend == CAIRO_EXTEND_PAD))
-    {
-        return CAIRO_STATUS_NO_MEMORY;
-    }
-
     _cairo_surface_copy_pattern_for_destination (source, surface, &dev_source.base);
     _cairo_surface_copy_pattern_for_destination (mask, surface, &dev_mask.base);
 
@@ -1345,12 +1333,6 @@ _cairo_surface_stroke (cairo_surface_t		
 
     assert (! surface->is_snapshot);
 
-    if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
-	(source->extend == CAIRO_EXTEND_REFLECT || source->extend == CAIRO_EXTEND_PAD))
-    {
-        return CAIRO_STATUS_NO_MEMORY;
-    }
-
     _cairo_surface_copy_pattern_for_destination (source, surface, &dev_source.base);
 
     if (surface->backend->stroke) {
@@ -1390,12 +1372,6 @@ _cairo_surface_fill (cairo_surface_t	*su
 
     assert (! surface->is_snapshot);
 
-    if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
-	(source->extend == CAIRO_EXTEND_REFLECT || source->extend == CAIRO_EXTEND_PAD))
-    {
-        return CAIRO_STATUS_NO_MEMORY;
-    }
-
     _cairo_surface_copy_pattern_for_destination (source, surface, &dev_source.base);
 
     if (surface->backend->fill) {
@@ -1797,12 +1773,6 @@ _cairo_surface_show_glyphs (cairo_surfac
 
     assert (! surface->is_snapshot);
 
-    if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
-	(source->extend == CAIRO_EXTEND_REFLECT || source->extend == CAIRO_EXTEND_PAD))
-    {
-        return CAIRO_STATUS_NO_MEMORY;
-    }
-
     if (!num_glyphs)
 	return CAIRO_STATUS_SUCCESS;
 
diff-tree a57bc6b6973a270ef85d73089ebd9d10b3bc5aa8 (from 5a72aac5982015a2b237afeb13164e0c5f5185ed)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Feb 21 17:59:28 2007 -0500

    [test] Add ref image for extend-reflect

diff --git a/test/extend-reflect-ref.png b/test/extend-reflect-ref.png
new file mode 100644
index 0000000..7645362
Binary files /dev/null and b/test/extend-reflect-ref.png differ


More information about the cairo-commit mailing list