[cairo-commit] 12 commits - test/device-offset.c test/device-offset-positive.c test/device-offset-scale.c test/extend-pad.c test/operator-clear.c test/operator-source.c test/pixman-rotate.c test/rotate-image-surface-paint.c test/surface-pattern-scale-down.c test/surface-pattern-scale-up.c test/unbounded-operator.c test/xlib-expose-event.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Oct 21 03:56:59 PDT 2008
test/device-offset-positive.c | 12 +++++-------
test/device-offset-scale.c | 14 +++++++-------
test/device-offset.c | 6 +++---
test/extend-pad.c | 7 ++++---
test/operator-clear.c | 6 ++----
test/operator-source.c | 12 ++++--------
test/pixman-rotate.c | 33 ++++++++++++++++-----------------
test/rotate-image-surface-paint.c | 7 ++++---
test/surface-pattern-scale-down.c | 7 ++++---
test/surface-pattern-scale-up.c | 7 ++++---
test/unbounded-operator.c | 6 ++----
test/xlib-expose-event.c | 10 +++++++---
12 files changed, 62 insertions(+), 65 deletions(-)
New commits:
commit 5a822046cc66d8405618370c1071433016969020
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:22:48 2008 +0100
[test/xlib-expose-event] Propagate errors.
Use cairo_get_target() to propagate errors from secondary contexts.
diff --git a/test/xlib-expose-event.c b/test/xlib-expose-event.c
index 189b8f1..2d2a6c1 100644
--- a/test/xlib-expose-event.c
+++ b/test/xlib-expose-event.c
@@ -85,6 +85,7 @@ draw_mask (cairo_t *cr)
cairo_boilerplate_xlib_surface_disable_render (surface);
cr2 = cairo_create (surface);
+ cairo_surface_destroy (surface);
/* This complex clip and forcing of fallbacks is to reproduce bug
* http://bugs.freedesktop.org/show_bug.cgi?id=10921
@@ -103,11 +104,10 @@ draw_mask (cairo_t *cr)
cairo_line_to (cr2, 25, 50);
cairo_set_source_rgb (cr2, 1, 1, 1);
cairo_stroke (cr2);
- cairo_destroy (cr2);
cairo_set_source_rgb (cr, 1, 0, 0);
- cairo_mask_surface (cr, surface, 50, 50);
- cairo_surface_destroy (surface);
+ cairo_mask_surface (cr, cairo_get_target (cr2), 50, 50);
+ cairo_destroy (cr2);
}
static cairo_surface_t *
@@ -122,9 +122,13 @@ clone_similar_surface (cairo_surface_t * target, cairo_surface_t *surface)
cairo_image_surface_get_height (surface));
cr = cairo_create (similar);
+ cairo_surface_destroy (similar);
+
cairo_set_source_surface (cr, surface, 0, 0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
+
+ similar = cairo_surface_reference (cairo_get_target (cr));
cairo_destroy (cr);
return similar;
commit 21223cc12ca00c52c0b39dc60db410f29e4e76c9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:29:12 2008 +0100
[test/unbounded-operator] Propagate errors.
Use cairo_get_target() to propagate errors from secondary contexts.
diff --git a/test/unbounded-operator.c b/test/unbounded-operator.c
index 043edfd..25d4345 100644
--- a/test/unbounded-operator.c
+++ b/test/unbounded-operator.c
@@ -47,6 +47,7 @@ draw_mask (cairo_t *cr, int x, int y)
CAIRO_CONTENT_ALPHA,
width, height);
cr2 = cairo_create (mask_surface);
+ cairo_surface_destroy (mask_surface);
cairo_save (cr2);
cairo_set_source_rgba (cr2, 0, 0, 0, 0); /* transparent */
@@ -59,11 +60,8 @@ draw_mask (cairo_t *cr, int x, int y)
cairo_arc (cr2, 0.5 * width, 0.5 * height, 0.45 * height, 0, 2 * M_PI);
cairo_fill (cr2);
+ cairo_mask_surface (cr, cairo_get_target (cr2), x, y);
cairo_destroy (cr2);
-
- cairo_mask_surface (cr, mask_surface, x, y);
-
- cairo_surface_destroy (mask_surface);
}
static void
commit 4c8de6d99d337338d6fd57134247515f9815b5e5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:21:37 2008 +0100
[test/surface-pattern-scale-up] Propagate errors.
Use cairo_get_target() to propagate errors from the secondary context.
diff --git a/test/surface-pattern-scale-up.c b/test/surface-pattern-scale-up.c
index ef7a4d1..3c09753 100644
--- a/test/surface-pattern-scale-up.c
+++ b/test/surface-pattern-scale-up.c
@@ -55,6 +55,8 @@ draw (cairo_t *cr, int width, int height)
surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
surface_size, surface_size);
cr_surface = cairo_create (surface);
+ cairo_surface_destroy (surface);
+
cairo_set_source_rgb (cr_surface, 1, 1, 1);
cairo_rectangle (cr_surface,
0, 0,
@@ -75,12 +77,11 @@ draw (cairo_t *cr, int width, int height)
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, 4, -4.5);
- cairo_surface_destroy (surface);
+ cairo_set_source_surface (cr, cairo_get_target (cr_surface), 4, -4.5);
+ cairo_destroy (cr_surface);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_NONE);
cairo_paint (cr);
commit e8de7d1c3605fa6d89640fb4e0631c07e5366348
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:20:54 2008 +0100
[test/surface-pattern-scale-down] Propagate errors.
Use cairo_get_target() to propagate errors from the secondary context.
diff --git a/test/surface-pattern-scale-down.c b/test/surface-pattern-scale-down.c
index 4e9b48f..842371b 100644
--- a/test/surface-pattern-scale-down.c
+++ b/test/surface-pattern-scale-down.c
@@ -55,6 +55,8 @@ draw (cairo_t *cr, int width, int height)
surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
surface_size, surface_size);
cr_surface = cairo_create (surface);
+ cairo_surface_destroy (surface);
+
cairo_set_source_rgb (cr_surface, 1, 1, 1);
cairo_rectangle (cr_surface,
0, 0,
@@ -75,12 +77,11 @@ draw (cairo_t *cr, int width, int height)
surface_size / 2, surface_size / 2,
surface_size / 2, surface_size / 2);
cairo_fill (cr_surface);
- cairo_destroy (cr_surface);
cairo_scale (cr, 0.2, 0.2);
cairo_rotate (cr, 1.);
- cairo_set_source_surface (cr, surface, 225, -225);
- cairo_surface_destroy (surface);
+ cairo_set_source_surface (cr, cairo_get_target (cr_surface), 225, -225);
+ cairo_destroy (cr_surface);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_NONE);
cairo_paint (cr);
commit b5551cfce2969358746dadae90cbe1add012e29c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:19:40 2008 +0100
[test/rotate-image-surface-paint] Proapgate errors.
Use cairo_get_target() to propagate errors from the secondary context.
diff --git a/test/rotate-image-surface-paint.c b/test/rotate-image-surface-paint.c
index 25ce9c5..f1e9e4f 100644
--- a/test/rotate-image-surface-paint.c
+++ b/test/rotate-image-surface-paint.c
@@ -51,6 +51,8 @@ draw (cairo_t *cr, int width, int height)
surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
surface_size, surface_size);
cr_surface = cairo_create (surface);
+ cairo_surface_destroy (surface);
+
cairo_set_source_rgb (cr_surface, 1, 1, 1);
cairo_rectangle (cr_surface,
0, 0,
@@ -71,7 +73,6 @@ draw (cairo_t *cr, int width, int height)
surface_size / 2, surface_size / 2,
surface_size / 2, surface_size / 2);
cairo_fill (cr_surface);
- cairo_destroy (cr_surface);
/* First paint opaque background (black) so we don't need separate
* ARGB32 and RGB24 reference images. */
@@ -82,11 +83,11 @@ draw (cairo_t *cr, int width, int height)
cairo_rotate (cr, M_PI / 4.0);
cairo_translate (cr, -surface_size/2, -surface_size/2);
- cairo_set_source_surface (cr, surface, 0, 0);
+ cairo_set_source_surface (cr, cairo_get_target (cr_surface), 0, 0);
+ cairo_destroy (cr_surface);
cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST);
cairo_paint (cr);
- cairo_surface_destroy (surface);
return CAIRO_TEST_SUCCESS;
}
commit 6d41ffbbed2ad3bab2b1a58e1e5d9e1570a37926
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:18:37 2008 +0100
[test/pixman-rotate] Propagate errors
Use cairo_get_target() to propagate errors from the secondary context.
diff --git a/test/pixman-rotate.c b/test/pixman-rotate.c
index d115494..313b34d 100644
--- a/test/pixman-rotate.c
+++ b/test/pixman-rotate.c
@@ -55,10 +55,25 @@ draw (cairo_t *cr, int width, int height)
cairo_surface_t *stamp;
cairo_t *cr2;
+ /* Draw a translucent rectangle for reference where the rotated
+ * image should be. */
+ cairo_new_path (cr);
+ cairo_rectangle (cr, WIDTH, HEIGHT, WIDTH, HEIGHT);
+ cairo_set_source_rgba (cr, 1, 1, 0, 0.3);
+ cairo_fill (cr);
+
+#if 1 /* Set to 0 to generate reference image */
+ cairo_translate (cr, 2 * WIDTH, 2 * HEIGHT);
+ cairo_rotate (cr, M_PI);
+#else
+ cairo_translate (cr, WIDTH, HEIGHT);
+#endif
+
stamp = cairo_surface_create_similar (cairo_get_group_target (cr),
CAIRO_CONTENT_COLOR_ALPHA,
WIDTH, HEIGHT);
cr2 = cairo_create (stamp);
+ cairo_surface_destroy (stamp);
{
cairo_new_path (cr2);
cairo_rectangle (cr2, WIDTH / 4, HEIGHT / 4, WIDTH / 2, HEIGHT / 2);
@@ -70,27 +85,11 @@ draw (cairo_t *cr, int width, int height)
cairo_set_source_rgb (cr2, 0, 0, 0);
cairo_stroke (cr2);
}
+ cairo_set_source_surface (cr, cairo_get_target (cr2), 0, 0);
cairo_destroy (cr2);
- /* Draw a translucent rectangle for reference where the rotated
- * image should be. */
- cairo_new_path (cr);
- cairo_rectangle (cr, WIDTH, HEIGHT, WIDTH, HEIGHT);
- cairo_set_source_rgba (cr, 1, 1, 0, 0.3);
- cairo_fill (cr);
-
-#if 1 /* Set to 0 to generate reference image */
- cairo_translate (cr, 2 * WIDTH, 2 * HEIGHT);
- cairo_rotate (cr, M_PI);
-#else
- cairo_translate (cr, WIDTH, HEIGHT);
-#endif
-
- cairo_set_source_surface (cr, stamp, 0, 0);
cairo_paint (cr);
- cairo_surface_destroy (stamp);
-
return CAIRO_TEST_SUCCESS;
}
commit 64949b81735ee4e43772224d10031f7edfbc8068
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:17:13 2008 +0100
[test/operator-source] Propagate errors.
Use cairo_get_target() to propagate errors from the secondary context.
diff --git a/test/operator-source.c b/test/operator-source.c
index 882723e..b4968ad 100644
--- a/test/operator-source.c
+++ b/test/operator-source.c
@@ -71,6 +71,7 @@ set_surface_pattern (cairo_t *cr, int x, int y)
CAIRO_CONTENT_COLOR_ALPHA,
width, height);
cr2 = cairo_create (source_surface);
+ cairo_surface_destroy (source_surface);
cairo_set_source_rgb (cr2, 1, 0, 0); /* red */
cairo_paint (cr2);
@@ -80,11 +81,8 @@ set_surface_pattern (cairo_t *cr, int x, int y)
cairo_arc (cr2, 0.5 * width, 0.5 * height, 0.5 * height, 0, 2 * M_PI);
cairo_fill (cr2);
+ cairo_set_source_surface (cr, cairo_get_target (cr2), x, y);
cairo_destroy (cr2);
-
- cairo_set_source_surface (cr, source_surface, x, y);
-
- cairo_surface_destroy (source_surface);
}
static void
@@ -102,17 +100,15 @@ draw_mask (cairo_t *cr, int x, int y)
CAIRO_CONTENT_ALPHA,
width, height);
cr2 = cairo_create (mask_surface);
+ cairo_surface_destroy (mask_surface);
cairo_set_source_rgb (cr2, 1, 1, 1); /* white */
cairo_arc (cr2, 0.5 * width, 0.5 * height, 0.45 * height, 0, 2 * M_PI);
cairo_fill (cr2);
+ cairo_mask_surface (cr, cairo_get_target (cr2), x, y);
cairo_destroy (cr2);
-
- cairo_mask_surface (cr, mask_surface, x, y);
-
- cairo_surface_destroy (mask_surface);
}
static void
commit 971f030b7dca7ce24e54d0465900e6984020345e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:27:17 2008 +0100
[test/operator-clear] Propagate errors.
Use cairo_get_target() to propagate errors from secondary contexts.
diff --git a/test/operator-clear.c b/test/operator-clear.c
index f1eb322..d6c4d30 100644
--- a/test/operator-clear.c
+++ b/test/operator-clear.c
@@ -65,17 +65,15 @@ draw_mask (cairo_t *cr, int x, int y)
CAIRO_CONTENT_ALPHA,
width, height);
cr2 = cairo_create (mask_surface);
+ cairo_surface_destroy (mask_surface);
cairo_set_source_rgb (cr2, 1, 1, 1); /* white */
cairo_arc (cr2, 0.5 * width, 0.5 * height, 0.45 * height, 0, 2 * M_PI);
cairo_fill (cr2);
+ cairo_mask_surface (cr, cairo_get_target (cr2), x, y);
cairo_destroy (cr2);
-
- cairo_mask_surface (cr, mask_surface, x, y);
-
- cairo_surface_destroy (mask_surface);
}
static void
commit 9b919b0e91b6c64acbcbfc05c72610188327be67
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:14:51 2008 +0100
[test/extend-pad] Propagate errors.
Use cairo_get_target() to propagate errors from the secondary context.
diff --git a/test/extend-pad.c b/test/extend-pad.c
index 8c3c09c..b122f15 100644
--- a/test/extend-pad.c
+++ b/test/extend-pad.c
@@ -55,6 +55,8 @@ draw (cairo_t *cr, int width, int height)
surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
surface_size, surface_size);
cr_surface = cairo_create (surface);
+ cairo_surface_destroy (surface);
+
cairo_set_source_rgb (cr_surface, 1, 1, 1);
cairo_rectangle (cr_surface,
0, 0,
@@ -75,11 +77,10 @@ draw (cairo_t *cr, int width, int height)
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);
+ cairo_set_source_surface (cr, cairo_get_target (cr_surface), 1.5, 1.5);
+ cairo_destroy (cr_surface);
/* Using EXTEND_REFLECT makes this test pass for image and xlib backends */
/*cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REFLECT);*/
commit 69415b4fc6387acda7498847f8181c802c8b0982
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:25:38 2008 +0100
[test/device-offset-scale] Propagate errors
Use cairo_get_target() to propagate errors from the secondary contexts.
diff --git a/test/device-offset-scale.c b/test/device-offset-scale.c
index eabe15a..7effebe 100644
--- a/test/device-offset-scale.c
+++ b/test/device-offset-scale.c
@@ -41,16 +41,13 @@ static const cairo_test_t test = {
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
+ cairo_surface_t *second;
cairo_t *second_cr;
- cairo_surface_t *second = cairo_image_surface_create (CAIRO_FORMAT_A8, 10, 10);
/* fill with black so we don't need an rgb test case */
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_paint (cr);
- /* adjust the offset so that the second rectangle will fit on the surface */
- cairo_surface_set_device_offset (second, -6, -6);
-
cairo_scale (cr, 0.5, 0.5);
/* draw the first rectangle */
@@ -58,19 +55,22 @@ draw (cairo_t *cr, int width, int height)
cairo_rectangle (cr, 6, 6, 10, 10);
cairo_fill (cr);
+ /* adjust the offset so that the second rectangle will fit on the surface */
+ second = cairo_image_surface_create (CAIRO_FORMAT_A8, 10, 10);
+ cairo_surface_set_device_offset (second, -6, -6);
+
/* draw the second rectangle:
* this rectangle should end up in the same place as the rectangle above
* independent of the device offset of the surface it is painted on*/
second_cr = cairo_create (second);
+ cairo_surface_destroy (second);
cairo_rectangle (second_cr, 6, 6, 10, 10);
cairo_fill (second_cr);
/* paint the second rectangle on top of the first rectangle */
cairo_set_source_rgb (cr, 0.5, 0.5, 0);
- cairo_mask_surface (cr, second, 0, 0);
-
+ cairo_mask_surface (cr, cairo_get_target (second_cr), 0, 0);
cairo_destroy (second_cr);
- cairo_surface_destroy (second);
return CAIRO_TEST_SUCCESS;
}
commit 9ab296123ef49259a67e8dc43708023da2759283
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:14:01 2008 +0100
[test/device-offset-positive] Propagate errors.
Use cairo_get_target() to propagate errors from the secondary context.
diff --git a/test/device-offset-positive.c b/test/device-offset-positive.c
index 4b49b10..082f3d7 100644
--- a/test/device-offset-positive.c
+++ b/test/device-offset-positive.c
@@ -64,23 +64,21 @@ draw (cairo_t *cr, int width, int height)
cairo_surface_get_content (target),
SIZE / 2, SIZE / 2);
cr2 = cairo_create (surface);
+ cairo_surface_destroy (surface);
cairo_set_source_rgb (cr2, 1, 0, 0); /* red */
draw_square (cr2);
+ /* Finally, copy the offset surface to the original destination.
+ * The final result should be a blue square with the upper-left
+ * quarter red. */
+ surface = cairo_surface_reference (cairo_get_target (cr2));
cairo_destroy (cr2);
-
cairo_surface_set_device_offset (surface, + SIZE / 2, + SIZE / 2);
-
- /* Finally, copy the offset surface to the original destination.
- * The final result should be a blue square with the upper-left
- * quarter red. */
cairo_set_source_surface (cr, surface, SIZE / 2, SIZE / 2);
cairo_paint (cr);
- cairo_surface_destroy (surface);
-
return CAIRO_TEST_SUCCESS;
}
commit 594fa0836f2526e0a7f44fc7184f7f09de7dd41f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Oct 21 11:12:11 2008 +0100
[test/device-offset] Propagate error.
Use cairo_get_target() to propagate errors from the secondary context.
diff --git a/test/device-offset.c b/test/device-offset.c
index dfeb508..a7a6731 100644
--- a/test/device-offset.c
+++ b/test/device-offset.c
@@ -65,20 +65,20 @@ draw (cairo_t *cr, int width, int height)
SIZE / 2, SIZE / 2);
cairo_surface_set_device_offset (surface, - SIZE / 2, - SIZE / 2);
cr2 = cairo_create (surface);
+ cairo_surface_destroy (surface);
cairo_set_source_rgb (cr2, 1, 0, 0); /* red */
draw_square (cr2);
- cairo_destroy (cr2);
/* Finally, copy the offset surface to the original destination.
* The final result should be a blue square with the lower-right
* quarter red. */
- cairo_set_source_surface (cr, surface, 0, 0);
+ cairo_set_source_surface (cr, cairo_get_target (cr2), 0, 0);
+ cairo_destroy (cr2);
cairo_paint (cr);
- cairo_surface_destroy (surface);
return CAIRO_TEST_SUCCESS;
}
More information about the cairo-commit
mailing list