[cairo-commit] 7 commits - boilerplate/cairo-boilerplate.c boilerplate/cairo-boilerplate.h src/cairo-image-surface.c src/cairoint.h src/cairo-matrix.c src/cairo-pattern.c src/cairo-xlib-surface.c test/cairo-test.c test/Makefile.am test/scale-offset-image.c test/scale-offset-image.ps.ref.png test/scale-offset-image.ref.png test/scale-offset-similar.c test/scale-offset-similar.ps.ref.png test/scale-offset-similar.ref.png test/surface-pattern.pdf.ref.png test/surface-pattern.ref.png test/surface-pattern.svg11.ref.png test/surface-pattern.svg12.ref.png test/surface-pattern.svg.ref.png util/cairo-trace

Chris Wilson ickle at kemper.freedesktop.org
Wed Nov 5 00:45:36 PST 2008


 boilerplate/cairo-boilerplate.c      |   40 +++++----
 boilerplate/cairo-boilerplate.h      |    1 
 dev/null                             |binary
 src/cairo-image-surface.c            |   25 ++++--
 src/cairo-matrix.c                   |   24 +++--
 src/cairo-pattern.c                  |    3 
 src/cairo-xlib-surface.c             |   33 +++++---
 src/cairoint.h                       |    4 
 test/Makefile.am                     |   14 ++-
 test/cairo-test.c                    |   13 ++-
 test/scale-offset-image.c            |  142 ++++++++++++++++++++++++++++++++++
 test/scale-offset-image.ps.ref.png   |binary
 test/scale-offset-image.ref.png      |binary
 test/scale-offset-similar.c          |  143 +++++++++++++++++++++++++++++++++++
 test/scale-offset-similar.ps.ref.png |binary
 test/scale-offset-similar.ref.png    |binary
 test/surface-pattern.pdf.ref.png     |binary
 test/surface-pattern.ref.png         |binary
 test/surface-pattern.svg.ref.png     |binary
 util/cairo-trace/trace.c             |  140 +++++++++++++++++++++++++++++-----
 20 files changed, 513 insertions(+), 69 deletions(-)

New commits:
commit d1b8186fd75922e73e62ef8f2ebb011e334ebe36
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 5 01:16:25 2008 +0000

    [trace] Correct emission of set_font_face and set_source
    
    set_font_face was not consuming it's operand but blithely placing an
    undefined font_face onto the operand stack, whereas set_source was
    performing invalid exchanges on the stack.

diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index c16efc6..c12820e 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -1423,13 +1423,6 @@ cairo_set_source (cairo_t *cr, cairo_pattern_t *source)
 	    _exch_operands ();
 	    _consume_operand ();
 	}
-	else if (_is_current (PATTERN, source, 0))
-	{
-	    _emit_context (cr);
-	    fprintf (logfile, "exch ");
-	    _exch_operands ();
-	    _consume_operand ();
-	}
 	else
 	{
 	    _emit_context (cr);
@@ -1938,8 +1931,33 @@ cairo_get_font_face (cairo_t *cr)
 void
 cairo_set_font_face (cairo_t *cr, cairo_font_face_t *font_face)
 {
-    _emit_cairo_op (cr, "f%ld set_font_face\n",
-		    _get_font_face_id (font_face));
+    if (cr != NULL && font_face != NULL) {
+	if (_pop_operands_to (FONT_FACE, font_face)) {
+	    if (_is_current (CONTEXT, cr, 1)) {
+		if (_write_lock ()) {
+		    _consume_operand ();
+		    fprintf (logfile, "set_font_face\n");
+		    _write_unlock ();
+		}
+	    } else {
+		if (_get_object (CONTEXT, cr)->defined) {
+		    if (_write_lock ()) {
+			_consume_operand ();
+			fprintf (logfile,
+				 "c%ld exch set_font_face pop\n",
+				 _get_context_id (cr));
+			_write_unlock ();
+		    }
+		} else {
+		    _emit_cairo_op (cr, "f%ld set_font_face\n",
+				    _get_font_face_id (font_face));
+		}
+	    }
+	} else {
+	    _emit_cairo_op (cr, "f%ld set_font_face\n",
+			    _get_font_face_id (font_face));
+	}
+    }
 
     return DLCALL (cairo_set_font_face, cr, font_face);
 }
commit 4a4b10271a614ee9bf982994b8f9ec6b6102ee10
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 5 00:02:09 2008 +0000

    [trace] Capture foreign drawables.
    
    If we attempt to use a surface as a source before we write to it, record
    the surface contents.

diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index b79f7df..c16efc6 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -107,6 +107,8 @@ struct _object {
     const void *addr;
     Type *type;
     unsigned long int token;
+    int width, height;
+    bool foreign;
     bool defined;
     int operand;
     void *data;
@@ -333,6 +335,7 @@ _object_create (Type *type, const void *ptr)
 
     obj = malloc (sizeof (Object));
     obj->defined = false;
+    obj->foreign = false;
     obj->operand = -1;
     obj->type = type;
     obj->addr = ptr;
@@ -1214,6 +1217,7 @@ cairo_create (cairo_surface_t *target)
 
     if (target != NULL && _write_lock ()) {
 	surface_id = _get_surface_id (target);
+	_get_object (SURFACE, target)->foreign = false;
 
 	/* we presume that we will continue to use the context */
 	if (_pop_operands_to (SURFACE, target)){
@@ -1335,6 +1339,40 @@ cairo_set_source_rgba (cairo_t *cr, double red, double green, double blue, doubl
     return DLCALL (cairo_set_source_rgba, cr, red, green, blue, alpha);
 }
 
+static void
+_emit_source_image (cairo_surface_t *surface)
+{
+    Object *obj;
+    cairo_surface_t *image;
+    cairo_t *cr;
+
+    obj = _get_object (SURFACE, surface);
+
+    image = DLCALL (cairo_image_surface_create,
+		    CAIRO_FORMAT_ARGB32,
+		    obj->width,
+		    obj->height);
+    cr = DLCALL (cairo_create, image);
+    DLCALL (cairo_set_source_surface, cr, surface, 0, 0);
+    DLCALL (cairo_paint, cr);
+    DLCALL (cairo_destroy, cr);
+
+    fprintf (logfile,
+	     "dict\n"
+	     "  /width %d set\n"
+	     "  /height %d set\n"
+	     "  /format //ARGB32 set\n"
+	     "  /source ",
+	     obj->width, obj->height);
+    _emit_image (image);
+    fprintf (logfile,
+	     " /deflate filter set\n"
+	     "  image set_source_image ");
+    DLCALL (cairo_surface_destroy, image);
+
+    _get_object (SURFACE, surface)->foreign = false;
+}
+
 void
 cairo_set_source_surface (cairo_t *cr, cairo_surface_t *surface, double x, double y)
 {
@@ -1355,6 +1393,9 @@ cairo_set_source_surface (cairo_t *cr, cairo_surface_t *surface, double x, doubl
 	    fprintf (logfile, "s%ld ", _get_surface_id (surface));
 	}
 
+	if (_get_object (SURFACE, surface)->foreign)
+	    _emit_source_image (surface);
+
 	fprintf (logfile, "pattern");
 	if (x != 0. || y != 0.)
 	    fprintf (logfile, " %g %g translate", -x, -y);
@@ -2078,7 +2119,6 @@ cairo_scaled_font_create (cairo_font_face_t *font_face,
 {
     cairo_scaled_font_t *ret;
     long scaled_font_id;
-    long font_face_id;
 
     ret = DLCALL (cairo_scaled_font_create, font_face, font_matrix, ctm, options);
     scaled_font_id = _create_scaled_font_id (ret);
@@ -2395,12 +2435,27 @@ cairo_image_surface_create_for_data (unsigned char *data, cairo_format_t format,
 		 "dict\n"
 		 "  /width %d set\n"
 		 "  /height %d set\n"
-		 "  /format //%s set\n"
-		 "  /source ",
-		 width, height, format_str);
-	_emit_image (ret);
+		 "  /format //%s set\n",
+		 width, height,
+		 format_str);
+
+	/* cairo_image_surface_create_for_data() is both used to supply
+	 * foreign pixel data to cairo and in order to read pixels back.
+	 * Defer grabbing the pixel contents until we have to, but only for
+	 * "large" images, for small images the overhead of embedding pixels
+	 * is negligible.
+	 */
+	if (width * height < 128) {
+	    fprintf (logfile, "  /source ");
+	    _emit_image (ret);
+	    fprintf (logfile, " /deflate filter set\n");
+	} else {
+	    _get_object (SURFACE, ret)->width  = width;
+	    _get_object (SURFACE, ret)->height = height;
+	    _get_object (SURFACE, ret)->foreign = true;
+	}
+
 	fprintf (logfile,
-		 " /deflate filter set\n"
 		 "  image dup /s%ld exch def\n",
 		 surface_id);
 	_get_object (SURFACE, ret)->defined = true;
@@ -2650,6 +2705,10 @@ cairo_pattern_create_for_surface (cairo_surface_t *surface)
 	} else {
 	    fprintf (logfile, "s%ld ", surface_id);
 	}
+
+	if (_get_object (SURFACE, surface)->foreign)
+	    _emit_source_image (surface);
+
 	fprintf (logfile, "pattern %% p%ld\n", pattern_id);
 	_push_operand (PATTERN, ret);
 	_write_unlock ();
@@ -3238,7 +3297,10 @@ cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func, void *c
 #include <cairo-xlib.h>
 
 cairo_surface_t *
-cairo_xlib_surface_create (Display *dpy, Drawable drawable, Visual *visual, int width, int height)
+cairo_xlib_surface_create (Display *dpy,
+			   Drawable drawable,
+			   Visual *visual,
+			   int width, int height)
 {
     cairo_surface_t *ret;
     long surface_id;
@@ -3251,13 +3313,18 @@ cairo_xlib_surface_create (Display *dpy, Drawable drawable, Visual *visual, int
 	fprintf (logfile,
 		 "dict\n"
 		 "  /type (xlib) set\n"
+		 "  /drawable /%lx set\n"
 		 "  /width %d set\n"
 		 "  /height %d set\n"
 		 "  surface dup /s%ld exch def\n",
+		 drawable,
 		 width,
 		 height,
 		 surface_id);
 	_get_object (SURFACE, ret)->defined = true;
+	_get_object (SURFACE, ret)->width  = width;
+	_get_object (SURFACE, ret)->height = height;
+	_get_object (SURFACE, ret)->foreign = true;
 	_push_operand (SURFACE, ret);
 	_write_unlock ();
     }
@@ -3266,7 +3333,10 @@ cairo_xlib_surface_create (Display *dpy, Drawable drawable, Visual *visual, int
 }
 
 cairo_surface_t *
-cairo_xlib_surface_create_for_bitmap (Display *dpy, Pixmap bitmap, Screen *screen, int width, int height)
+cairo_xlib_surface_create_for_bitmap (Display *dpy,
+				      Pixmap bitmap,
+				      Screen *screen,
+				      int width, int height)
 {
     cairo_surface_t *ret;
     long surface_id;
@@ -3279,14 +3349,19 @@ cairo_xlib_surface_create_for_bitmap (Display *dpy, Pixmap bitmap, Screen *scree
 	fprintf (logfile,
 		 "dict\n"
 		 "  /type (xlib) set\n"
+		 "  /drawable /%lx set\n"
 		 "  /width %d set\n"
 		 "  /height %d set\n"
 		 "  /depth 1 set\n"
 		 "  surface dup /s%ld exch def\n",
+		 bitmap,
 		 width,
 		 height,
 		 surface_id);
 	_get_object (SURFACE, ret)->defined = true;
+	_get_object (SURFACE, ret)->width  = width;
+	_get_object (SURFACE, ret)->height = height;
+	_get_object (SURFACE, ret)->foreign = true;
 	_push_operand (SURFACE, ret);
 	_write_unlock ();
     }
@@ -3297,7 +3372,11 @@ cairo_xlib_surface_create_for_bitmap (Display *dpy, Pixmap bitmap, Screen *scree
 #if CAIRO_HAS_XLIB_XRENDER_SURFACE
 #include <cairo-xlib-xrender.h>
 cairo_surface_t *
-cairo_xlib_surface_create_with_xrender_format (Display *dpy, Drawable drawable, Screen *screen, XRenderPictFormat *format, int width, int height)
+cairo_xlib_surface_create_with_xrender_format (Display *dpy,
+					       Drawable drawable,
+					       Screen *screen,
+					       XRenderPictFormat *format,
+					       int width, int height)
 {
     cairo_surface_t *ret;
     long surface_id;
@@ -3310,15 +3389,20 @@ cairo_xlib_surface_create_with_xrender_format (Display *dpy, Drawable drawable,
 	fprintf (logfile,
 		 "dict\n"
 		 "  /type (xrender) set\n"
+		 "  /drawable /%lx set\n"
 		 "  /width %d set\n"
 		 "  /height %d set\n"
 		 "  /depth %d set\n"
 		 "  surface dup /s%ld exch def\n",
+		 drawable,
 		 width,
 		 height,
 		 format->depth,
 		 surface_id);
 	_get_object (SURFACE, ret)->defined = true;
+	_get_object (SURFACE, ret)->width  = width;
+	_get_object (SURFACE, ret)->height = height;
+	_get_object (SURFACE, ret)->foreign = true;
 	_push_operand (SURFACE, ret);
 	_write_unlock ();
     }
commit 432fe1ec2792153ec2559ef52aece3fcdc9c5df4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Nov 4 15:30:23 2008 +0000

    [trace] Mark filter mode as immediate.
    
    Be consistent and use "//" for the filter mode to indicate a constant.

diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index b958e75..b79f7df 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -2751,7 +2751,7 @@ _filter_to_string (cairo_filter_t filter)
 void
 cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter)
 {
-    _emit_pattern_op (pattern, "%s set_filter\n", _filter_to_string (filter));
+    _emit_pattern_op (pattern, "//%s set_filter\n", _filter_to_string (filter));
     return DLCALL (cairo_pattern_set_filter, pattern, filter);
 }
 
commit 68309481aa9295026e3e7e6407c793f899b5e600
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Nov 5 08:03:01 2008 +0000

    [test] Mark targets with is_meta?
    
    Allow tests to skip targets based on whether they are a meta surface or
    not.

diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 632624f..50f9f39 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -313,7 +313,9 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_test_meta_create_surface, NULL,
 	NULL,
 	_cairo_boilerplate_get_image_surface,
-	cairo_surface_write_to_png
+	cairo_surface_write_to_png,
+	NULL, NULL,
+	FALSE, TRUE
     },
     {
 	"test-meta", "image", NULL,
@@ -322,7 +324,9 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_test_meta_create_surface, NULL,
 	NULL,
 	_cairo_boilerplate_get_image_surface,
-	cairo_surface_write_to_png
+	cairo_surface_write_to_png,
+	NULL, NULL,
+	FALSE, TRUE
     },
     {
 	"test-paginated", "image", NULL,
@@ -332,7 +336,9 @@ static cairo_boilerplate_target_t targets[] =
 	NULL,
 	_cairo_boilerplate_test_paginated_get_image_surface,
 	_cairo_boilerplate_test_paginated_surface_write_to_png,
-	_cairo_boilerplate_test_paginated_cleanup
+	_cairo_boilerplate_test_paginated_cleanup,
+	NULL,
+	FALSE, TRUE,
     },
     {
 	"test-paginated", "image", NULL,
@@ -342,7 +348,9 @@ static cairo_boilerplate_target_t targets[] =
 	NULL,
 	_cairo_boilerplate_test_paginated_get_image_surface,
 	_cairo_boilerplate_test_paginated_surface_write_to_png,
-	_cairo_boilerplate_test_paginated_cleanup
+	_cairo_boilerplate_test_paginated_cleanup,
+	NULL,
+	FALSE, TRUE
     },
 #endif
 #ifdef CAIRO_HAS_GLITZ_SURFACE
@@ -457,7 +465,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_win32_printing_get_image_surface,
 	_cairo_boilerplate_win32_printing_surface_write_to_png,
 	_cairo_boilerplate_win32_printing_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
     {
 	"win32-printing", "win32"".ps",
@@ -467,7 +475,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_win32_printing_get_image_surface,
 	_cairo_boilerplate_win32_printing_surface_write_to_png,
 	_cairo_boilerplate_win32_printing_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
 #endif
 #endif
@@ -533,7 +541,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_ps_get_image_surface,
 	_cairo_boilerplate_ps_surface_write_to_png,
 	_cairo_boilerplate_ps_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
     {
 	"ps2", "ps", ".ps",
@@ -544,7 +552,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_ps_get_image_surface,
 	_cairo_boilerplate_ps_surface_write_to_png,
 	_cairo_boilerplate_ps_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
     {
 	"ps3", "ps", ".ps",
@@ -556,7 +564,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_ps_get_image_surface,
 	_cairo_boilerplate_ps_surface_write_to_png,
 	_cairo_boilerplate_ps_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
     {
 	"ps3", "ps", ".ps",
@@ -567,7 +575,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_ps_get_image_surface,
 	_cairo_boilerplate_ps_surface_write_to_png,
 	_cairo_boilerplate_ps_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
 #endif
 #if CAIRO_HAS_PDF_SURFACE && CAIRO_CAN_TEST_PDF_SURFACE
@@ -581,7 +589,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_pdf_get_image_surface,
 	_cairo_boilerplate_pdf_surface_write_to_png,
 	_cairo_boilerplate_pdf_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
     {
 	"pdf", "pdf", ".pdf",
@@ -592,7 +600,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_pdf_get_image_surface,
 	_cairo_boilerplate_pdf_surface_write_to_png,
 	_cairo_boilerplate_pdf_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
 #endif
 #if CAIRO_HAS_SVG_SURFACE && CAIRO_CAN_TEST_SVG_SURFACE
@@ -610,7 +618,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_svg_get_image_surface,
 	_cairo_boilerplate_svg_surface_write_to_png,
 	_cairo_boilerplate_svg_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
     {
 	"svg11", "svg", NULL,
@@ -621,7 +629,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_svg_get_image_surface,
 	_cairo_boilerplate_svg_surface_write_to_png,
 	_cairo_boilerplate_svg_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
     {
 	"svg12", "svg", NULL,
@@ -632,7 +640,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_svg_get_image_surface,
 	_cairo_boilerplate_svg_surface_write_to_png,
 	_cairo_boilerplate_svg_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
     {
 	"svg12", "svg", NULL,
@@ -643,7 +651,7 @@ static cairo_boilerplate_target_t targets[] =
 	_cairo_boilerplate_svg_get_image_surface,
 	_cairo_boilerplate_svg_surface_write_to_png,
 	_cairo_boilerplate_svg_cleanup,
-	NULL, TRUE
+	NULL, TRUE, TRUE
     },
 #endif
 #if CAIRO_HAS_BEOS_SURFACE
diff --git a/boilerplate/cairo-boilerplate.h b/boilerplate/cairo-boilerplate.h
index 9d12b8d..19b2957 100644
--- a/boilerplate/cairo-boilerplate.h
+++ b/boilerplate/cairo-boilerplate.h
@@ -162,6 +162,7 @@ typedef struct _cairo_boilerplate_target
     cairo_boilerplate_cleanup_t			 cleanup;
     cairo_boilerplate_wait_t			 synchronize;
     cairo_bool_t				 is_vector;
+    cairo_bool_t				 is_meta;
 } cairo_boilerplate_target_t;
 
 cairo_boilerplate_target_t **
diff --git a/test/cairo-test.c b/test/cairo-test.c
index 90ca0af..24d693d 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -704,7 +704,9 @@ cairo_test_for_target (cairo_test_context_t		 *ctx,
     xasprintf (&diff_path, "%s" CAIRO_TEST_DIFF_SUFFIX, base_path);
 
     if (ctx->test->requirements != NULL) {
-	const char *required = target->is_vector ? "target=raster" : "target=vector";
+	const char *required;
+
+	required = target->is_vector ? "target=raster" : "target=vector";
 	if (strstr (ctx->test->requirements, required) != NULL) {
 	    cairo_test_log (ctx, "Error: Skipping for %s target %s\n",
 			    target->is_vector ? "vector" : "raster",
@@ -712,6 +714,15 @@ cairo_test_for_target (cairo_test_context_t		 *ctx,
 	    ret = CAIRO_TEST_UNTESTED;
 	    goto UNWIND_STRINGS;
 	}
+
+	required = target->is_meta ? "target=!meta" : "target=meta";
+	if (strstr (ctx->test->requirements, required) != NULL) {
+	    cairo_test_log (ctx, "Error: Skipping for %s target %s\n",
+			    target->is_meta ? "meta" : "non-meta",
+			    target->name);
+	    ret = CAIRO_TEST_UNTESTED;
+	    goto UNWIND_STRINGS;
+	}
     }
 
     width = ctx->test->width;
commit 8855f9583e84ae2e6d981e21133f590bff2065ab
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Nov 4 20:04:02 2008 +0000

    [test] Add scale-offset-(similar|image)
    
    Add a test case for the scaling bug reported by Michel Iwaniec:
    http://lists.cairographics.org/archives/cairo/2008-November/015660.html

diff --git a/test/Makefile.am b/test/Makefile.am
index 2938969..db1acf1 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -141,6 +141,8 @@ test_sources = \
 	rgb24-ignore-alpha.c				\
 	rotate-image-surface-paint.c			\
 	scale-down-source-surface-paint.c		\
+	scale-offset-image.c				\
+	scale-offset-similar.c				\
 	scale-source-surface-paint.c			\
 	stroke-ctm-caps.c				\
 	stroke-image.c				        \
@@ -812,6 +814,10 @@ REFERENCE_IMAGES = \
 	rotate-image-surface-paint.svg12.ref.png	\
 	rotate-image-surface-paint.svg11.ref.png	\
 	scale-down-source-surface-paint.ref.png	\
+	scale-offset-image.ref.png		\
+	scale-offset-image.ps.ref.png		\
+	scale-offset-similar.ref.png		\
+	scale-offset-similar.ps.ref.png		\
 	scale-source-surface-paint.pdf.argb32.ref.png	\
 	scale-source-surface-paint.ref.png	\
 	scale-source-surface-paint.rgb24.ref.png	\
diff --git a/test/scale-offset-image.c b/test/scale-offset-image.c
new file mode 100644
index 0000000..ab55342
--- /dev/null
+++ b/test/scale-offset-image.c
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2008 Chris Wilson
+ *
+ * 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
+ * Chris Wilson not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Chris Wilson makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL CHRIS WILSON 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: Chris Wilson <chris at chris-wilson.co.uk>
+ */
+
+/*
+ * Test case derived from the bug report by Michel Iwaniec:
+ * http://lists.cairographics.org/archives/cairo/2008-November/015660.html
+ */
+
+#include "cairo-test.h"
+
+static cairo_surface_t *
+create_source (cairo_surface_t *target, int width, int height)
+{
+    cairo_surface_t *similar;
+    cairo_t *cr;
+
+    similar = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
+					    width, height);
+    cr = cairo_create (similar);
+    cairo_surface_destroy (similar);
+
+    cairo_set_source_rgb (cr, 1, 1, 1);
+    cairo_rectangle (cr,
+		     width - 4, height - 4,
+		     2, 2);
+    cairo_fill (cr);
+    cairo_set_source_rgb (cr, 1, 0, 0);
+    cairo_rectangle (cr,
+		     width - 2, height - 4,
+		     2, 2);
+    cairo_fill (cr);
+    cairo_set_source_rgb (cr, 0, 1, 0);
+    cairo_rectangle (cr,
+		     width - 4, height - 2,
+		     2, 2);
+    cairo_fill (cr);
+    cairo_set_source_rgb (cr, 0, 0, 1);
+    cairo_rectangle (cr,
+		     width - 2, height - 2,
+		     2, 2);
+    cairo_fill (cr);
+
+    similar = cairo_surface_reference (cairo_get_target (cr));
+    cairo_destroy (cr);
+
+    return similar;
+}
+
+static void
+draw_grid (cairo_t *cr, cairo_pattern_t *pattern, int dst_x, int dst_y)
+{
+    cairo_matrix_t m;
+
+    cairo_save (cr);
+    cairo_translate (cr, dst_x, dst_y);
+    cairo_scale (cr, 16, 16);
+    cairo_rotate (cr, 1);
+
+    cairo_matrix_init_translate (&m, 2560-4, 1280-4);
+    cairo_pattern_set_matrix (pattern, &m);
+    cairo_set_source (cr, pattern);
+    cairo_rectangle (cr, 0, 0, 4, 4);
+    cairo_fill (cr);
+
+    cairo_set_source_rgb (cr, .7, .7, .7);
+    cairo_set_line_width (cr, 1./16);
+    cairo_move_to (cr, 0, 0);
+    cairo_line_to (cr, 4, 0);
+    cairo_move_to (cr, 0, 2);
+    cairo_line_to (cr, 4, 2);
+    cairo_move_to (cr, 0, 4);
+    cairo_line_to (cr, 4, 4);
+    cairo_move_to (cr, 0, 0);
+    cairo_line_to (cr, 0, 4);
+    cairo_move_to (cr, 2, 0);
+    cairo_line_to (cr, 2, 4);
+    cairo_move_to (cr, 4, 0);
+    cairo_line_to (cr, 4, 4);
+    cairo_stroke (cr);
+
+    cairo_restore (cr);
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+    cairo_surface_t *source;
+    cairo_pattern_t *pattern;
+
+    cairo_paint (cr);
+
+    source = create_source (cairo_get_target (cr), 2560, 1280);
+    pattern = cairo_pattern_create_for_surface (source);
+    cairo_surface_destroy (source);
+
+    cairo_pattern_set_filter (pattern, CAIRO_FILTER_NEAREST);
+    cairo_pattern_set_extend (pattern, CAIRO_EXTEND_NONE);
+
+    draw_grid (cr, pattern, 50, 0);
+    draw_grid (cr, pattern, 130, 0);
+    draw_grid (cr, pattern, 210, 0);
+    draw_grid (cr, pattern, 290, 0);
+
+    draw_grid (cr, pattern, 50,  230);
+    draw_grid (cr, pattern, 130, 230);
+    draw_grid (cr, pattern, 210, 230);
+    draw_grid (cr, pattern, 290, 230);
+
+    cairo_pattern_destroy (pattern);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (scale_offset_image,
+	    "Tests drawing surfaces under various scales and transforms",
+	    "XFAIL=!ps surface scale-offset", /* keywords */
+	    NULL, /* requirements */
+	    320, 320,
+	    NULL, draw)
+
diff --git a/test/scale-offset-image.ps.ref.png b/test/scale-offset-image.ps.ref.png
new file mode 100644
index 0000000..b87612a
Binary files /dev/null and b/test/scale-offset-image.ps.ref.png differ
diff --git a/test/scale-offset-image.ref.png b/test/scale-offset-image.ref.png
new file mode 100644
index 0000000..325bdf4
Binary files /dev/null and b/test/scale-offset-image.ref.png differ
diff --git a/test/scale-offset-similar.c b/test/scale-offset-similar.c
new file mode 100644
index 0000000..074ce05
--- /dev/null
+++ b/test/scale-offset-similar.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2008 Chris Wilson
+ *
+ * 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
+ * Chris Wilson not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Chris Wilson makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL CHRIS WILSON 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: Chris Wilson <chris at chris-wilson.co.uk>
+ */
+
+/*
+ * Test case derived from the bug report by Michel Iwaniec:
+ * http://lists.cairographics.org/archives/cairo/2008-November/015660.html
+ */
+
+#include "cairo-test.h"
+
+static cairo_surface_t *
+create_source (cairo_surface_t *target, int width, int height)
+{
+    cairo_surface_t *similar;
+    cairo_t *cr;
+
+    similar = cairo_surface_create_similar (target,
+					    CAIRO_CONTENT_COLOR,
+					    width, height);
+    cr = cairo_create (similar);
+    cairo_surface_destroy (similar);
+
+    cairo_set_source_rgb (cr, 1, 1, 1);
+    cairo_rectangle (cr,
+		     width - 4, height - 4,
+		     2, 2);
+    cairo_fill (cr);
+    cairo_set_source_rgb (cr, 1, 0, 0);
+    cairo_rectangle (cr,
+		     width - 2, height - 4,
+		     2, 2);
+    cairo_fill (cr);
+    cairo_set_source_rgb (cr, 0, 1, 0);
+    cairo_rectangle (cr,
+		     width - 4, height - 2,
+		     2, 2);
+    cairo_fill (cr);
+    cairo_set_source_rgb (cr, 0, 0, 1);
+    cairo_rectangle (cr,
+		     width - 2, height - 2,
+		     2, 2);
+    cairo_fill (cr);
+
+    similar = cairo_surface_reference (cairo_get_target (cr));
+    cairo_destroy (cr);
+
+    return similar;
+}
+
+static void
+draw_grid (cairo_t *cr, cairo_pattern_t *pattern, int dst_x, int dst_y)
+{
+    cairo_matrix_t m;
+
+    cairo_save (cr);
+    cairo_translate (cr, dst_x, dst_y);
+    cairo_scale (cr, 16, 16);
+    cairo_rotate (cr, 1);
+
+    cairo_matrix_init_translate (&m, 2560-4, 1280-4);
+    cairo_pattern_set_matrix (pattern, &m);
+    cairo_set_source (cr, pattern);
+    cairo_rectangle (cr, 0, 0, 4, 4);
+    cairo_fill (cr);
+
+    cairo_set_source_rgb (cr, .7, .7, .7);
+    cairo_set_line_width (cr, 1./16);
+    cairo_move_to (cr, 0, 0);
+    cairo_line_to (cr, 4, 0);
+    cairo_move_to (cr, 0, 2);
+    cairo_line_to (cr, 4, 2);
+    cairo_move_to (cr, 0, 4);
+    cairo_line_to (cr, 4, 4);
+    cairo_move_to (cr, 0, 0);
+    cairo_line_to (cr, 0, 4);
+    cairo_move_to (cr, 2, 0);
+    cairo_line_to (cr, 2, 4);
+    cairo_move_to (cr, 4, 0);
+    cairo_line_to (cr, 4, 4);
+    cairo_stroke (cr);
+
+    cairo_restore (cr);
+}
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+    cairo_surface_t *source;
+    cairo_pattern_t *pattern;
+
+    cairo_paint (cr);
+
+    source = create_source (cairo_get_target (cr), 2560, 1280);
+    pattern = cairo_pattern_create_for_surface (source);
+    cairo_surface_destroy (source);
+
+    cairo_pattern_set_filter (pattern, CAIRO_FILTER_NEAREST);
+    cairo_pattern_set_extend (pattern, CAIRO_EXTEND_NONE);
+
+    draw_grid (cr, pattern, 50, 0);
+    draw_grid (cr, pattern, 130, 0);
+    draw_grid (cr, pattern, 210, 0);
+    draw_grid (cr, pattern, 290, 0);
+
+    draw_grid (cr, pattern, 50,  230);
+    draw_grid (cr, pattern, 130, 230);
+    draw_grid (cr, pattern, 210, 230);
+    draw_grid (cr, pattern, 290, 230);
+
+    cairo_pattern_destroy (pattern);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (scale_offset_similar,
+	    "Tests drawing surfaces under various scales and transforms",
+	    "XFAIL=!ps surface scale-offset", /* keywords */
+	    NULL, /* requirements */
+	    320, 320,
+	    NULL, draw)
+
diff --git a/test/scale-offset-similar.ps.ref.png b/test/scale-offset-similar.ps.ref.png
new file mode 100644
index 0000000..a60e9ad
Binary files /dev/null and b/test/scale-offset-similar.ps.ref.png differ
diff --git a/test/scale-offset-similar.ref.png b/test/scale-offset-similar.ref.png
new file mode 100644
index 0000000..325bdf4
Binary files /dev/null and b/test/scale-offset-similar.ref.png differ
commit aad980900314bd032468f41a3216769c66e62097
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Nov 4 19:11:55 2008 +0000

    [test] Only depend on any2ppm if we build it.
    
    Do not add a dependency to any2ppm if it has been deconfigured.

diff --git a/test/Makefile.am b/test/Makefile.am
index e3d42d8..2938969 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -283,8 +283,11 @@ cairo_test_suite_LDADD = 					\
 cairo_test_suite_DEPENDENCIES = \
 	$(top_builddir)/test/pdiff/libpdiff.la 			\
         $(top_builddir)/boilerplate/libcairoboilerplate.la	\
-	$(top_builddir)/src/libcairo.la 			\
+	$(top_builddir)/src/libcairo.la
+if BUILD_ANY2PPM
+cairo_test_suite_DEPENDENCIES += \
 	any2ppm
+endif
 if HAVE_PTHREAD
 cairo_test_suite_LDADD += -lpthread
 endif
commit 59bdeba9abd7bef15c6855d707c4cf92b623cb00
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Nov 4 18:42:05 2008 +0000

    [matrix] Minimise pixman conversion error.
    
    Minimise the error of the pixman matrix about the centre of the displayed
    area rather than the origin.

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 12614c1..f84cf7f 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -806,11 +806,12 @@ _cairo_image_surface_clone_similar (void		*abstract_surface,
 
 static cairo_status_t
 _cairo_image_surface_set_matrix (cairo_image_surface_t	*surface,
-				 const cairo_matrix_t	*matrix)
+				 const cairo_matrix_t	*matrix,
+				 double xc, double yc)
 {
     pixman_transform_t pixman_transform;
 
-    _cairo_matrix_to_pixman_matrix (matrix, &pixman_transform);
+    _cairo_matrix_to_pixman_matrix (matrix, &pixman_transform, xc, yc);
 
     if (! pixman_image_set_transform (surface->pixman_image, &pixman_transform))
 	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
@@ -862,11 +863,13 @@ _cairo_image_surface_set_filter (cairo_image_surface_t *surface,
 
 static cairo_status_t
 _cairo_image_surface_set_attributes (cairo_image_surface_t      *surface,
-				     cairo_surface_attributes_t *attributes)
+				     cairo_surface_attributes_t *attributes,
+				     double xc, double yc)
 {
     cairo_int_status_t status;
 
-    status = _cairo_image_surface_set_matrix (surface, &attributes->matrix);
+    status = _cairo_image_surface_set_matrix (surface, &attributes->matrix,
+					      xc, yc);
     if (status)
 	return status;
 
@@ -968,13 +971,17 @@ _cairo_image_surface_composite (cairo_operator_t	op,
     if (status)
 	return status;
 
-    status = _cairo_image_surface_set_attributes (src, &src_attr);
+    status = _cairo_image_surface_set_attributes (src, &src_attr,
+						  dst_x + width / 2.,
+						  dst_y + height / 2.);
     if (status)
-      goto CLEANUP_SURFACES;
+	goto CLEANUP_SURFACES;
 
     if (mask)
     {
-	status = _cairo_image_surface_set_attributes (mask, &mask_attr);
+	status = _cairo_image_surface_set_attributes (mask, &mask_attr,
+						      dst_x + width / 2.,
+						      dst_y + height / 2.);
 	if (status)
 	    goto CLEANUP_SURFACES;
 
@@ -1151,7 +1158,9 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t	op,
     if (status)
 	goto finish;
 
-    status = _cairo_image_surface_set_attributes (src, &attributes);
+    status = _cairo_image_surface_set_attributes (src, &attributes,
+						  src_x + width / 2.,
+						  src_y + height / 2.);
     if (status)
 	goto CLEANUP_SOURCE;
 
diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c
index b644dec..555c4fe 100644
--- a/src/cairo-matrix.c
+++ b/src/cairo-matrix.c
@@ -865,7 +865,9 @@ _cairo_matrix_transformed_circle_major_axis (cairo_matrix_t *matrix, double radi
 
 void
 _cairo_matrix_to_pixman_matrix (const cairo_matrix_t	*matrix,
-				pixman_transform_t	*pixman_transform)
+				pixman_transform_t	*pixman_transform,
+				double xc,
+				double yc)
 {
     static const pixman_transform_t pixman_identity_transform = {{
         {1 << 16,        0,       0},
@@ -875,8 +877,7 @@ _cairo_matrix_to_pixman_matrix (const cairo_matrix_t	*matrix,
 
     if (_cairo_matrix_is_identity (matrix)) {
         *pixman_transform = pixman_identity_transform;
-    }
-    else {
+    } else {
         cairo_matrix_t inv;
         double x,y;
         pixman_vector_t vector;
@@ -899,9 +900,10 @@ _cairo_matrix_to_pixman_matrix (const cairo_matrix_t	*matrix,
          * for cairo, while pixman uses rounded versions of xx ... yy.
          * This error increases as a and b get larger.
          *
-         * To compensate for this, we fix the point (0, 0) in pattern
+         * To compensate for this, we fix the point (xc, yc) in pattern
          * space and adjust pixman's transform to agree with cairo's at
-         * that point. */
+         * that point.
+	 */
 
 	if (_cairo_matrix_is_translation (matrix))
 	    return;
@@ -911,8 +913,8 @@ _cairo_matrix_to_pixman_matrix (const cairo_matrix_t	*matrix,
         if (cairo_matrix_invert (&inv) != CAIRO_STATUS_SUCCESS)
             return;
 
-        /* find the device space coordinate that maps to (0, 0) */
-        x = 0, y = 0;
+        /* find the device space coordinate that maps to (xc, yc) */
+        x = xc, y = yc;
         cairo_matrix_transform_point (&inv, &x, &y);
 
         /* transform the resulting device space coordinate back
@@ -924,9 +926,11 @@ _cairo_matrix_to_pixman_matrix (const cairo_matrix_t	*matrix,
         if (! pixman_transform_point_3d (pixman_transform, &vector))
             return;
 
-        /* Ideally, the vector should now be (0, 0). We can now compensate
+        /* Ideally, the vector should now be (xc, yc). We can now compensate
          * for the resulting error */
-        pixman_transform->matrix[0][2] -= vector.vector[0];
-        pixman_transform->matrix[1][2] -= vector.vector[1];
+        pixman_transform->matrix[0][2] +=
+	    _cairo_fixed_16_16_from_double (xc) - vector.vector[0];
+        pixman_transform->matrix[1][2] +=
+	    _cairo_fixed_16_16_from_double (yc) - vector.vector[1];
     }
 }
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 02b0674..5a6bf6c 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1403,7 +1403,8 @@ _cairo_pattern_acquire_surface_for_gradient (const cairo_gradient_pattern_t *pat
 	return image->base.status;
     }
 
-    _cairo_matrix_to_pixman_matrix (&matrix, &pixman_transform);
+    _cairo_matrix_to_pixman_matrix (&matrix, &pixman_transform,
+				    width/2., height/2.);
     if (!pixman_image_set_transform (pixman_image, &pixman_transform)) {
 	cairo_surface_destroy (&image->base);
 	pixman_image_unref (pixman_image);
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index c59694d..12c2ccc 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1312,24 +1312,28 @@ _cairo_xlib_surface_create_solid_pattern_surface (void                  *abstrac
 
 static cairo_status_t
 _cairo_xlib_surface_set_matrix (cairo_xlib_surface_t *surface,
-				cairo_matrix_t	     *matrix)
+				cairo_matrix_t	     *matrix,
+				double                xc,
+				double                yc)
 {
     XTransform xtransform;
 
     if (!surface->src_picture)
 	return CAIRO_STATUS_SUCCESS;
-    
+
     /* Casting between pixman_transform_t and XTransform is safe because
      * they happen to be the exact same type.
      */
-    _cairo_matrix_to_pixman_matrix (matrix, (pixman_transform_t *)&xtransform);
+    _cairo_matrix_to_pixman_matrix (matrix,
+				    (pixman_transform_t *) &xtransform,
+				    xc, yc);
 
     if (memcmp (&xtransform, &surface->xtransform, sizeof (XTransform)) == 0)
 	return CAIRO_STATUS_SUCCESS;
 
     if (!CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM (surface))
 	return CAIRO_INT_STATUS_UNSUPPORTED;
-    
+
     XRenderSetPictureTransform (surface->dpy, surface->src_picture, &xtransform);
     surface->xtransform = xtransform;
 
@@ -1411,13 +1415,16 @@ _cairo_xlib_surface_set_repeat (cairo_xlib_surface_t *surface, int repeat)
 
 static cairo_int_status_t
 _cairo_xlib_surface_set_attributes (cairo_xlib_surface_t	    *surface,
-				    cairo_surface_attributes_t	    *attributes)
+				    cairo_surface_attributes_t	    *attributes,
+				    double			     xc,
+				    double			     yc)
 {
     cairo_int_status_t status;
 
     _cairo_xlib_surface_ensure_src_picture (surface);
 
-    status = _cairo_xlib_surface_set_matrix (surface, &attributes->matrix);
+    status = _cairo_xlib_surface_set_matrix (surface, &attributes->matrix,
+					     xc, yc);
     if (status)
 	return status;
 
@@ -1746,13 +1753,17 @@ _cairo_xlib_surface_composite (cairo_operator_t		op,
     switch (operation)
     {
     case DO_RENDER:
-	status = _cairo_xlib_surface_set_attributes (src, &src_attr);
+	status = _cairo_xlib_surface_set_attributes (src, &src_attr,
+						     dst_x + width / 2.,
+						     dst_y + height / 2.);
 	if (status)
 	    goto BAIL;
 
 	_cairo_xlib_surface_ensure_dst_picture (dst);
 	if (mask) {
-	    status = _cairo_xlib_surface_set_attributes (mask, &mask_attr);
+	    status = _cairo_xlib_surface_set_attributes (mask, &mask_attr,
+							 dst_x + width / 2.,
+							 dst_y + height/ 2.);
 	    if (status)
 		goto BAIL;
 
@@ -2161,7 +2172,9 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t	op,
     render_src_y = src_y + render_reference_y - dst_y;
 
     _cairo_xlib_surface_ensure_dst_picture (dst);
-    status = _cairo_xlib_surface_set_attributes (src, &attributes);
+    status = _cairo_xlib_surface_set_attributes (src, &attributes,
+						 dst_x + width / 2.,
+						 dst_y + height / 2.);
     if (status)
 	goto BAIL;
 
@@ -4064,7 +4077,7 @@ _cairo_xlib_surface_show_glyphs (void                *abstract_dst,
 	goto BAIL1;
     }
 
-    status = _cairo_xlib_surface_set_attributes (src, &attributes);
+    status = _cairo_xlib_surface_set_attributes (src, &attributes, 0, 0);
     if (status)
         goto BAIL1;
 
diff --git a/src/cairoint.h b/src/cairoint.h
index c7acbf7..63fefd7 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -2208,7 +2208,9 @@ _cairo_matrix_transformed_circle_major_axis(cairo_matrix_t *matrix, double radiu
 
 cairo_private void
 _cairo_matrix_to_pixman_matrix (const cairo_matrix_t	*matrix,
-				pixman_transform_t	*pixman_transform);
+				pixman_transform_t	*pixman_transform,
+				double                   xc,
+				double                   yc);
 
 /* cairo-traps.c */
 cairo_private void
diff --git a/test/Makefile.am b/test/Makefile.am
index 2ffbfb6..e3d42d8 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -912,8 +912,7 @@ REFERENCE_IMAGES = \
 	surface-pattern-scale-up.ps2.ref.png	\
 	surface-pattern-scale-up.ps3.ref.png	\
 	surface-pattern-scale-up.ref.png	\
-	surface-pattern.svg12.ref.png	\
-	surface-pattern.svg11.ref.png	\
+	surface-pattern.svg.ref.png	\
 	svg-surface-source.ref.png \
 	text-antialias-gray.ref.png	\
 	text-antialias-gray.quartz.ref.png	\
diff --git a/test/surface-pattern.pdf.ref.png b/test/surface-pattern.pdf.ref.png
index bfb3478..c37e2a4 100644
Binary files a/test/surface-pattern.pdf.ref.png and b/test/surface-pattern.pdf.ref.png differ
diff --git a/test/surface-pattern.ref.png b/test/surface-pattern.ref.png
index d1c2b33..9cdf6a5 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..2078fc0
Binary files /dev/null and b/test/surface-pattern.svg.ref.png differ
diff --git a/test/surface-pattern.svg11.ref.png b/test/surface-pattern.svg11.ref.png
deleted file mode 100644
index 5569a55..0000000
Binary files a/test/surface-pattern.svg11.ref.png and /dev/null differ
diff --git a/test/surface-pattern.svg12.ref.png b/test/surface-pattern.svg12.ref.png
deleted file mode 100644
index 5569a55..0000000
Binary files a/test/surface-pattern.svg12.ref.png and /dev/null differ


More information about the cairo-commit mailing list