[cairo-commit] 5 commits - test/big-little-box.argb32.ref.png test/big-little-box.c test/big-little-box.rgb24.ref.png test/checkerboard.c test/checkerboard.ref.png test/clip-rotate-image-surface-paint.ref.png test/Makefile.refs test/Makefile.sources test/record-extend.c test/record-extend-none-similar.ref.png test/record-extend-pad-similar.ref.png test/record-extend-reflect-similar.ref.png test/record-extend-repeat-similar.ref.png test/record-mesh.c test/record-mesh.ref.png test/rotate-clip-image-surface-paint.ref.png test/rotate-image-surface-paint.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Aug 20 06:12:42 PDT 2011


 test/Makefile.refs                           |   10 +
 test/Makefile.sources                        |    3 
 test/big-little-box.argb32.ref.png           |binary
 test/big-little-box.c                        |   69 +++++++++++
 test/big-little-box.rgb24.ref.png            |binary
 test/checkerboard.c                          |   48 +++++++
 test/checkerboard.ref.png                    |binary
 test/clip-rotate-image-surface-paint.ref.png |binary
 test/record-extend-none-similar.ref.png      |binary
 test/record-extend-pad-similar.ref.png       |binary
 test/record-extend-reflect-similar.ref.png   |binary
 test/record-extend-repeat-similar.ref.png    |binary
 test/record-extend.c                         |  112 ++++++++++++++----
 test/record-mesh.c                           |  166 +++++++++++++++++++++++++++
 test/record-mesh.ref.png                     |binary
 test/rotate-clip-image-surface-paint.ref.png |binary
 test/rotate-image-surface-paint.c            |   73 +++++++++++
 17 files changed, 459 insertions(+), 22 deletions(-)

New commits:
commit 2134306eaf3fda10ca89f0acac9ef6d69888690e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 19 12:22:52 2011 +0100

    test: Extend rotate-image-surface-paint
    
    Apply two common clipping methods just to add a little bit of further
    complication.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/Makefile.refs b/test/Makefile.refs
index 7f30e01..e0dd734 100644
--- a/test/Makefile.refs
+++ b/test/Makefile.refs
@@ -193,6 +193,7 @@ REFERENCE_IMAGES = \
 	clip-push-group.ref.png \
 	clip-push-group.svg.ref.png \
 	clip-push-group.xlib.ref.png \
+	clip-rotate-image-surface-paint.ref.png \
 	clip-shape.image16.ref.png \
 	clip-shape.ps.ref.png \
 	clip-shape.quartz.ref.png \
@@ -1080,6 +1081,7 @@ REFERENCE_IMAGES = \
 	rel-path.ref.png \
 	rel-path.rgb24.ref.png \
 	rgb24-ignore-alpha.ref.png \
+	rotate-clip-image-surface-paint.ref.png \
 	rotate-image-surface-paint.pdf.xfail.png \
 	rotate-image-surface-paint.ps.ref.png \
 	rotate-image-surface-paint.quartz.ref.png \
@@ -1288,6 +1290,9 @@ REFERENCE_IMAGES = \
 	svg-surface-source.rgb24.ref.png \
 	svg-surface-source.svg12.argb32.xfail.png \
 	svg-surface-source.svg12.rgb24.xfail.png \
+	test-fallback16-surface-source.ps.ref.png \
+	test-fallback16-surface-source.svg12.argb32.xfail.png \
+	test-fallback16-surface-source.svg12.rgb24.xfail.png \
 	text-antialias-gray.image16.ref.png \
 	text-antialias-gray.quartz.ref.png \
 	text-antialias-gray.ref.png \
diff --git a/test/clip-rotate-image-surface-paint.ref.png b/test/clip-rotate-image-surface-paint.ref.png
new file mode 100644
index 0000000..1093804
Binary files /dev/null and b/test/clip-rotate-image-surface-paint.ref.png differ
diff --git a/test/rotate-clip-image-surface-paint.ref.png b/test/rotate-clip-image-surface-paint.ref.png
new file mode 100644
index 0000000..7f74b2b
Binary files /dev/null and b/test/rotate-clip-image-surface-paint.ref.png differ
diff --git a/test/rotate-image-surface-paint.c b/test/rotate-image-surface-paint.c
index f592d63..42fda6e 100644
--- a/test/rotate-image-surface-paint.c
+++ b/test/rotate-image-surface-paint.c
@@ -90,6 +90,64 @@ draw (cairo_t *cr, int width, int height)
     return CAIRO_TEST_SUCCESS;
 }
 
+static cairo_test_status_t
+clip_draw (cairo_t *cr, int width, int height)
+{
+    cairo_pattern_t *source;
+    int surface_size = sqrt ((SIZE - 2*PAD)*(SIZE - 2*PAD)/2);
+
+    /* Use a gray (neutral) background, so we can spot if the backend pads
+     * with any other colour.
+     */
+    cairo_set_source_rgb (cr, .5, .5, .5);
+    cairo_paint (cr);
+
+    cairo_rectangle (cr, 2*PAD, 2*PAD, SIZE-4*PAD, SIZE-4*PAD);
+    cairo_clip (cr);
+
+    cairo_translate(cr, SIZE/2, SIZE/2);
+    cairo_rotate (cr, M_PI / 4.0);
+    cairo_translate (cr, -surface_size/2, -surface_size/2);
+
+    source = create_image_source (surface_size);
+    cairo_pattern_set_filter (source, CAIRO_FILTER_NEAREST);
+    cairo_set_source(cr, source);
+    cairo_pattern_destroy (source);
+
+    cairo_paint (cr);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+static cairo_test_status_t
+draw_clip (cairo_t *cr, int width, int height)
+{
+    cairo_pattern_t *source;
+    int surface_size = sqrt ((SIZE - 2*PAD)*(SIZE - 2*PAD)/2);
+
+    /* Use a gray (neutral) background, so we can spot if the backend pads
+     * with any other colour.
+     */
+    cairo_set_source_rgb (cr, .5, .5, .5);
+    cairo_paint (cr);
+
+    cairo_translate(cr, SIZE/2, SIZE/2);
+    cairo_rotate (cr, M_PI / 4.0);
+    cairo_translate (cr, -surface_size/2, -surface_size/2);
+
+    cairo_rectangle (cr, PAD, PAD, surface_size-2*PAD, surface_size-2*PAD);
+    cairo_clip (cr);
+
+    source = create_image_source (surface_size);
+    cairo_pattern_set_filter (source, CAIRO_FILTER_NEAREST);
+    cairo_set_source(cr, source);
+    cairo_pattern_destroy (source);
+
+    cairo_paint (cr);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
 CAIRO_TEST (rotate_image_surface_paint,
 	    "Test call sequence: image_surface_create; rotate; set_source_surface; paint"
 	    "\nThis test is known to fail on the ps backend currently",
@@ -97,3 +155,18 @@ CAIRO_TEST (rotate_image_surface_paint,
 	    NULL, /* requirements */
 	    SIZE, SIZE,
 	    NULL, draw)
+
+CAIRO_TEST (clip_rotate_image_surface_paint,
+	    "Test call sequence: image_surface_create; rotate; set_source_surface; paint"
+	    "\nThis test is known to fail on the ps backend currently",
+	    "image, transform, paint", /* keywords */
+	    NULL, /* requirements */
+	    SIZE, SIZE,
+	    NULL, clip_draw)
+CAIRO_TEST (rotate_clip_image_surface_paint,
+	    "Test call sequence: image_surface_create; rotate; set_source_surface; paint"
+	    "\nThis test is known to fail on the ps backend currently",
+	    "image, transform, paint", /* keywords */
+	    NULL, /* requirements */
+	    SIZE, SIZE,
+	    NULL, draw_clip)
commit 9f6820210d992a860c88e2a42c1f4bcd4a2de816
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 19 13:30:46 2011 +0100

    test: Extend record-extend to exercise similar surface sources
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/Makefile.refs b/test/Makefile.refs
index 082c61d..7f30e01 100644
--- a/test/Makefile.refs
+++ b/test/Makefile.refs
@@ -1019,9 +1019,13 @@ REFERENCE_IMAGES = \
 	random-intersections-nonzero.quartz.ref.png \
 	random-intersections-nonzero.ref.png \
 	random-intersections-nonzero.xlib.ref.png \
+	record-extend-none-similar.ref.png \
 	record-extend-none.ref.png \
+	record-extend-pad-similar.ref.png \
 	record-extend-pad.ref.png \
+	record-extend-reflect-similar.ref.png \
 	record-extend-reflect.ref.png \
+	record-extend-repeat-similar.ref.png \
 	record-extend-repeat.ref.png \
 	record-fill-alpha.ref.png \
 	record-mesh.ref.png \
diff --git a/test/record-extend-none-similar.ref.png b/test/record-extend-none-similar.ref.png
new file mode 100644
index 0000000..d63c31c
Binary files /dev/null and b/test/record-extend-none-similar.ref.png differ
diff --git a/test/record-extend-pad-similar.ref.png b/test/record-extend-pad-similar.ref.png
new file mode 100644
index 0000000..1291525
Binary files /dev/null and b/test/record-extend-pad-similar.ref.png differ
diff --git a/test/record-extend-reflect-similar.ref.png b/test/record-extend-reflect-similar.ref.png
new file mode 100644
index 0000000..aec5c94
Binary files /dev/null and b/test/record-extend-reflect-similar.ref.png differ
diff --git a/test/record-extend-repeat-similar.ref.png b/test/record-extend-repeat-similar.ref.png
new file mode 100644
index 0000000..d4db9bf
Binary files /dev/null and b/test/record-extend-repeat-similar.ref.png differ
diff --git a/test/record-extend.c b/test/record-extend.c
index a71c801..5ecef44 100644
--- a/test/record-extend.c
+++ b/test/record-extend.c
@@ -38,14 +38,12 @@
  */
 
 static cairo_surface_t *
-source (void)
+source (cairo_surface_t *surface)
 {
-    cairo_surface_t *surface;
     cairo_t *cr;
 
     /* Create a 4-pixel image surface with my favorite four colors in each
      * quadrant. */
-    surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 2, 2);
     cr = cairo_create (surface);
     cairo_surface_destroy (surface);
 
@@ -75,18 +73,31 @@ source (void)
     return surface;
 }
 
+static cairo_surface_t *
+image (cairo_t *cr)
+{
+    return source (cairo_image_surface_create (CAIRO_FORMAT_RGB24, 2, 2));
+}
+
+static cairo_surface_t *
+similar (cairo_t *cr)
+{
+    return source (cairo_surface_create_similar (cairo_get_target (cr),
+						 CAIRO_CONTENT_COLOR, 2, 2));
+}
+
 static cairo_t *
-extend (cairo_t *cr, cairo_extend_t mode)
+extend (cairo_t *cr, cairo_surface_t *(*surface)(cairo_t *), cairo_extend_t mode)
 {
-    cairo_surface_t *surface;
+    cairo_surface_t *s;
 
     cairo_set_source_rgb (cr, 0, 1, 1);
     cairo_paint (cr);
 
     /* Now use extend modes to cover most of the surface with those 4 colors */
-    surface = source ();
-    cairo_set_source_surface (cr, surface, SIZE/2 - 1, SIZE/2 - 1);
-    cairo_surface_destroy (surface);
+    s = surface (cr);
+    cairo_set_source_surface (cr, s, SIZE/2 - 1, SIZE/2 - 1);
+    cairo_surface_destroy (s);
 
     cairo_pattern_set_extend (cairo_get_source (cr), mode);
 
@@ -98,27 +109,31 @@ extend (cairo_t *cr, cairo_extend_t mode)
 }
 
 static cairo_t *
-extend_none (cairo_t *cr)
+extend_none (cairo_t *cr,
+	     cairo_surface_t *(*pattern)(cairo_t *))
 {
-    return extend (cr, CAIRO_EXTEND_NONE);
+    return extend (cr, pattern, CAIRO_EXTEND_NONE);
 }
 
 static cairo_t *
-extend_pad (cairo_t *cr)
+extend_pad (cairo_t *cr,
+	    cairo_surface_t *(*pattern)(cairo_t *))
 {
-    return extend (cr, CAIRO_EXTEND_PAD);
+    return extend (cr, pattern, CAIRO_EXTEND_PAD);
 }
 
 static cairo_t *
-extend_repeat (cairo_t *cr)
+extend_repeat (cairo_t *cr,
+	       cairo_surface_t *(*pattern)(cairo_t *))
 {
-    return extend (cr, CAIRO_EXTEND_REPEAT);
+    return extend (cr, pattern, CAIRO_EXTEND_REPEAT);
 }
 
 static cairo_t *
-extend_reflect (cairo_t *cr)
+extend_reflect (cairo_t *cr,
+	       cairo_surface_t *(*pattern)(cairo_t *))
 {
-    return extend (cr, CAIRO_EXTEND_REFLECT);
+    return extend (cr, pattern, CAIRO_EXTEND_REFLECT);
 }
 
 static cairo_t *
@@ -146,12 +161,16 @@ record_get (cairo_t *target)
 }
 
 static cairo_test_status_t
-record_replay (cairo_t *cr, cairo_t *(*func)(cairo_t *), int width, int height)
+record_replay (cairo_t *cr,
+	       cairo_t *(*func)(cairo_t *,
+				cairo_surface_t *(*pattern)(cairo_t *)),
+	       cairo_surface_t *(*pattern)(cairo_t *),
+	       int width, int height)
 {
     cairo_surface_t *surface;
     int x, y;
 
-    surface = record_get (func (record_create (cr)));
+    surface = record_get (func (record_create (cr), pattern));
 
     cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
     cairo_set_source_surface (cr, surface, 0, 0);
@@ -173,25 +192,49 @@ record_replay (cairo_t *cr, cairo_t *(*func)(cairo_t *), int width, int height)
 static cairo_test_status_t
 record_extend_none (cairo_t *cr, int width, int height)
 {
-    return record_replay (cr, extend_none, width, height);
+    return record_replay (cr, extend_none, image, width, height);
 }
 
 static cairo_test_status_t
 record_extend_pad (cairo_t *cr, int width, int height)
 {
-    return record_replay (cr, extend_pad, width, height);
+    return record_replay (cr, extend_pad, image, width, height);
 }
 
 static cairo_test_status_t
 record_extend_repeat (cairo_t *cr, int width, int height)
 {
-    return record_replay (cr, extend_repeat, width, height);
+    return record_replay (cr, extend_repeat, image, width, height);
 }
 
 static cairo_test_status_t
 record_extend_reflect (cairo_t *cr, int width, int height)
 {
-    return record_replay (cr, extend_reflect, width, height);
+    return record_replay (cr, extend_reflect, image, width, height);
+}
+
+static cairo_test_status_t
+record_extend_none_similar (cairo_t *cr, int width, int height)
+{
+    return record_replay (cr, extend_none, similar, width, height);
+}
+
+static cairo_test_status_t
+record_extend_pad_similar (cairo_t *cr, int width, int height)
+{
+    return record_replay (cr, extend_pad, similar, width, height);
+}
+
+static cairo_test_status_t
+record_extend_repeat_similar (cairo_t *cr, int width, int height)
+{
+    return record_replay (cr, extend_repeat, similar, width, height);
+}
+
+static cairo_test_status_t
+record_extend_reflect_similar (cairo_t *cr, int width, int height)
+{
+    return record_replay (cr, extend_reflect, similar, width, height);
 }
 
 CAIRO_TEST (record_extend_none,
@@ -218,3 +261,28 @@ CAIRO_TEST (record_extend_reflect,
 	    NULL, /* requirements */
 	    SIZE, SIZE,
 	    NULL, record_extend_reflect)
+
+CAIRO_TEST (record_extend_none_similar,
+	    "Test CAIRO_EXTEND_NONE for recorded surface patterns",
+	    "record, extend", /* keywords */
+	    NULL, /* requirements */
+	    SIZE, SIZE,
+	    NULL, record_extend_none_similar)
+CAIRO_TEST (record_extend_pad_similar,
+	    "Test CAIRO_EXTEND_PAD for recorded surface patterns",
+	    "record, extend", /* keywords */
+	    NULL, /* requirements */
+	    SIZE, SIZE,
+	    NULL, record_extend_pad_similar)
+CAIRO_TEST (record_extend_repeat_similar,
+	    "Test CAIRO_EXTEND_REPEAT for recorded surface patterns",
+	    "record, extend", /* keywords */
+	    NULL, /* requirements */
+	    SIZE, SIZE,
+	    NULL, record_extend_repeat_similar)
+CAIRO_TEST (record_extend_reflect_similar,
+	    "Test CAIRO_EXTEND_REFLECT for recorded surface patterns",
+	    "record, extend", /* keywords */
+	    NULL, /* requirements */
+	    SIZE, SIZE,
+	    NULL, record_extend_reflect_similar)
commit f8f25f52ecbe5934e17eb6ba6dcea9f9359ba83c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 19 12:52:33 2011 +0100

    test: Add record-mesh
    
    Test capture and replay of mesh patterns.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/Makefile.refs b/test/Makefile.refs
index 29c71ac..082c61d 100644
--- a/test/Makefile.refs
+++ b/test/Makefile.refs
@@ -1024,6 +1024,7 @@ REFERENCE_IMAGES = \
 	record-extend-reflect.ref.png \
 	record-extend-repeat.ref.png \
 	record-fill-alpha.ref.png \
+	record-mesh.ref.png \
 	record-paint-alpha-clip-mask.ref.png \
 	record-paint-alpha-clip.ref.png \
 	record-paint-alpha-solid-clip.ref.png \
diff --git a/test/Makefile.sources b/test/Makefile.sources
index d448104..f236e53 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -234,6 +234,7 @@ test_sources = \
 	random-intersections-curves-nz.c		\
 	record.c					\
 	record-extend.c					\
+	record-mesh.c					\
 	recording-surface-pattern.c			\
 	recording-surface-extend.c			\
 	rectangle-rounding-error.c			\
diff --git a/test/record-mesh.c b/test/record-mesh.c
new file mode 100644
index 0000000..2581ce7
--- /dev/null
+++ b/test/record-mesh.c
@@ -0,0 +1,166 @@
+/*
+ * Copyright © 2007 Red Hat, Inc.
+ * Copyright © 2009 Adrian Johnson
+ * Copyright © 2011 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *	Behdad Esfahbod <behdad at behdad.org>
+ *	Adrian Johnson <ajohnson at redneon.com>
+ *	Chris Wilson <chris at chris-wilson.co.uk>
+ */
+
+#include <math.h>
+#include "cairo-test.h"
+#include <stdio.h>
+
+#define PAT_WIDTH  170
+#define PAT_HEIGHT 170
+#define SIZE PAT_WIDTH
+#define PAD 2
+#define WIDTH (PAD + SIZE + PAD)
+#define HEIGHT WIDTH
+
+/* This test is designed to paint a mesh pattern. The mesh contains
+ * two overlapping patches */
+
+static cairo_pattern_t *
+mesh (void)
+{
+    cairo_pattern_t *pattern;
+
+    pattern = cairo_pattern_create_mesh ();
+
+    cairo_mesh_pattern_begin_patch (pattern);
+
+    cairo_mesh_pattern_move_to (pattern, 0, 0);
+    cairo_mesh_pattern_curve_to (pattern, 30, -30,  60,  30, 100, 0);
+    cairo_mesh_pattern_curve_to (pattern, 60,  30, 130,  60, 100, 100);
+    cairo_mesh_pattern_curve_to (pattern, 60,  70,  30, 130,   0, 100);
+    cairo_mesh_pattern_curve_to (pattern, 30,  70, -30,  30,   0, 0);
+
+    cairo_mesh_pattern_set_corner_color_rgb (pattern, 0, 1, 0, 0);
+    cairo_mesh_pattern_set_corner_color_rgb (pattern, 1, 0, 1, 0);
+    cairo_mesh_pattern_set_corner_color_rgb (pattern, 2, 0, 0, 1);
+    cairo_mesh_pattern_set_corner_color_rgb (pattern, 3, 1, 1, 0);
+
+    cairo_mesh_pattern_end_patch (pattern);
+
+    cairo_mesh_pattern_begin_patch (pattern);
+
+    cairo_mesh_pattern_move_to (pattern, 50, 50);
+    cairo_mesh_pattern_curve_to (pattern,  80,  20, 110,  80, 150, 50);
+    cairo_mesh_pattern_curve_to (pattern, 110,  80, 180, 110, 150, 150);
+    cairo_mesh_pattern_curve_to (pattern, 110, 120,  80, 180,  50, 150);
+    cairo_mesh_pattern_curve_to (pattern,  80, 120,  20,  80,  50, 50);
+
+    cairo_mesh_pattern_set_corner_color_rgba (pattern, 0, 1, 0, 0, 0.3);
+    cairo_mesh_pattern_set_corner_color_rgb  (pattern, 1, 0, 1, 0);
+    cairo_mesh_pattern_set_corner_color_rgba (pattern, 2, 0, 0, 1, 0.3);
+    cairo_mesh_pattern_set_corner_color_rgb  (pattern, 3, 1, 1, 0);
+
+    cairo_mesh_pattern_end_patch (pattern);
+
+    return pattern;
+}
+
+static cairo_t *
+draw (cairo_t *cr)
+{
+    cairo_pattern_t *source;
+
+    cairo_set_source_rgb (cr, 0, 1, 1);
+    cairo_paint (cr);
+
+    source = mesh ();
+    cairo_set_source (cr, source);
+    cairo_pattern_destroy (source);
+
+    cairo_rectangle (cr, 10, 10, SIZE-20, SIZE-20);
+    cairo_clip (cr);
+    cairo_paint (cr);
+
+    return cr;
+}
+
+static cairo_t *
+record_create (cairo_t *target)
+{
+    cairo_surface_t *surface;
+    cairo_t *cr;
+
+    surface = cairo_recording_surface_create (cairo_surface_get_content (cairo_get_target (target)), NULL);
+    cr = cairo_create (surface);
+    cairo_surface_destroy (surface);
+
+    return cr;
+}
+
+static cairo_surface_t *
+record_get (cairo_t *target)
+{
+    cairo_surface_t *surface;
+
+    surface = cairo_surface_reference (cairo_get_target (target));
+    cairo_destroy (target);
+
+    return surface;
+}
+
+static cairo_test_status_t
+record_replay (cairo_t *cr, cairo_t *(*func)(cairo_t *), int width, int height)
+{
+    cairo_surface_t *surface;
+    int x, y;
+
+    surface = record_get (func (record_create (cr)));
+
+    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+    cairo_set_source_surface (cr, surface, 0, 0);
+    cairo_surface_destroy (surface);
+    cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_NONE);
+
+    for (y = 0; y < height; y += 2) {
+	for (x = 0; x < width; x += 2) {
+	    cairo_rectangle (cr, x, y, 2, 2);
+	    cairo_clip (cr);
+	    cairo_paint (cr);
+	    cairo_reset_clip (cr);
+	}
+    }
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+static cairo_test_status_t
+record_mesh (cairo_t *cr, int width, int height)
+{
+    return record_replay (cr, draw, width, height);
+}
+
+CAIRO_TEST (record_mesh,
+	    "Paint mesh pattern through a recording surface",
+	    "record,mesh,pattern", /* keywords */
+	    NULL, /* requirements */
+	    WIDTH, HEIGHT,
+	    NULL, record_mesh)
+
diff --git a/test/record-mesh.ref.png b/test/record-mesh.ref.png
new file mode 100644
index 0000000..4921ba3
Binary files /dev/null and b/test/record-mesh.ref.png differ
commit 4226bfd695d39cff758491eb792bb85c5395b5dc
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 19 15:02:11 2011 +0100

    test: Add big-little-box
    
    This exercises the bug
    
      https://bugzilla.mozilla.org/show_bug.cgi?id=668921
    
    which is caused by a failure to tighten the extents after tessellating
    the path and the unbounded fixup is skipped as it is believed the path
    covers the whole area.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/Makefile.refs b/test/Makefile.refs
index f47a3c9..29c71ac 100644
--- a/test/Makefile.refs
+++ b/test/Makefile.refs
@@ -49,6 +49,8 @@ REFERENCE_IMAGES = \
 	big-line.quartz.ref.png \
 	big-line.ref.png \
 	big-line.xlib.ref.png \
+	big-little-box.argb32.ref.png \
+	big-little-box.rgb24.ref.png \
 	bilevel-image.ref.png \
 	bitmap-font.ref.png \
 	bitmap-font.rgb24.ref.png \
diff --git a/test/Makefile.sources b/test/Makefile.sources
index f2a3b07..d448104 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -15,6 +15,7 @@ test_sources = \
 	arc-looping-dash.c				\
 	api-special-cases.c				\
 	big-line.c					\
+	big-little-box.c				\
 	big-trap.c					\
 	bilevel-image.c					\
 	bug-bo-rectangular.c				\
diff --git a/test/big-little-box.argb32.ref.png b/test/big-little-box.argb32.ref.png
new file mode 100644
index 0000000..928c5e6
Binary files /dev/null and b/test/big-little-box.argb32.ref.png differ
diff --git a/test/big-little-box.c b/test/big-little-box.c
new file mode 100644
index 0000000..1787ee5
--- /dev/null
+++ b/test/big-little-box.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright © 2011 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Chris Wilson <chris at chris-wilson.co.uk>
+ */
+
+/*
+ * This attempts to exercise the bug found in
+ *
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=668921
+ *
+ * and also identified by Taekyun Kim.
+ *
+ * The issue is that we failed to tighten the initial approximated bounds
+ * after tessellating the path.
+ */
+
+#include "cairo-test.h"
+
+#define SIZE 60
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+    cairo_set_source_rgb (cr, 1, 0, 1);
+    cairo_paint (cr);
+
+    /* Set an unbounded operator so that we can see how accurate the bounded
+     * extents were.
+     */
+    cairo_set_operator (cr, CAIRO_OPERATOR_IN);
+    cairo_set_source_rgb (cr, 1, 1, 1);
+
+    /* Wind several boxes together that reduce to just one */
+    cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
+    cairo_rectangle (cr, 0, 0, SIZE, SIZE);
+    cairo_rectangle (cr, 0, 0, SIZE, SIZE);
+    cairo_rectangle (cr, SIZE/2 - 20, SIZE/2 - 20, 40, 40);
+    cairo_fill (cr);
+
+    return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (big_little_box,
+	    "Tests that we tighten the bounds after tessellation.",
+	    "fill", /* keywords */
+	    NULL, /* requirements */
+	    SIZE, SIZE,
+	    NULL, draw)
diff --git a/test/big-little-box.rgb24.ref.png b/test/big-little-box.rgb24.ref.png
new file mode 100644
index 0000000..c069d6f
Binary files /dev/null and b/test/big-little-box.rgb24.ref.png differ
commit 2eeae45cc71817a803c911f2fba4771bc40d3045
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Aug 19 09:53:40 2011 +0100

    test: Add checkerboard
    
    Simply tests the rendering of the checkerboard commonly used as a
    background in the test suite.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/Makefile.refs b/test/Makefile.refs
index 500fd82..f47a3c9 100644
--- a/test/Makefile.refs
+++ b/test/Makefile.refs
@@ -82,6 +82,7 @@ REFERENCE_IMAGES = \
 	caps.image16.ref.png \
 	caps.ps.ref.png \
 	caps.ref.png \
+	checkerboard.ref.png \
 	clear-source.image16.ref.png \
 	clear-source.pdf.xfail.png \
 	clear-source.ps.xfail.png \
@@ -1280,9 +1281,6 @@ REFERENCE_IMAGES = \
 	svg-surface-source.rgb24.ref.png \
 	svg-surface-source.svg12.argb32.xfail.png \
 	svg-surface-source.svg12.rgb24.xfail.png \
-	test-fallback16-surface-source.ps.ref.png \
-	test-fallback16-surface-source.svg12.argb32.xfail.png \
-	test-fallback16-surface-source.svg12.rgb24.xfail.png \
 	text-antialias-gray.image16.ref.png \
 	text-antialias-gray.quartz.ref.png \
 	text-antialias-gray.ref.png \
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 7001193..f2a3b07 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -21,6 +21,7 @@ test_sources = \
 	bug-extents.c					\
 	bug-seams.c					\
 	caps.c						\
+	checkerboard.c					\
 	caps-joins.c					\
 	caps-joins-alpha.c				\
 	caps-joins-curve.c				\
diff --git a/test/checkerboard.c b/test/checkerboard.c
new file mode 100644
index 0000000..aeb2efe
--- /dev/null
+++ b/test/checkerboard.c
@@ -0,0 +1,48 @@
+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
+/*
+ * Copyright 2011 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Author: Chris Wilson <chris at chris-wilson.co.uk>
+ */
+
+/* Test the basic background used extensively in the test suite. */
+
+#include "cairo-test.h"
+
+#define HEIGHT 32
+#define WIDTH 32
+
+static cairo_test_status_t
+draw (cairo_t *cr, int width, int height)
+{
+    cairo_test_paint_checkered (cr);
+    return CAIRO_TEST_SUCCESS;
+}
+
+CAIRO_TEST (checkerboard,
+	    "Tests the checkerboard background",
+	    "paint", /* keywords */
+	    NULL, /* requirements */
+	    WIDTH, HEIGHT,
+	    NULL, draw)
+
diff --git a/test/checkerboard.ref.png b/test/checkerboard.ref.png
new file mode 100644
index 0000000..1444bc4
Binary files /dev/null and b/test/checkerboard.ref.png differ


More information about the cairo-commit mailing list