[cairo-commit] 7 commits - perf/cairo-perf-cover.c src/cairo.c src/cairo-meta-surface.c src/cairo-ps-surface.c src/cairo-surface.c test/cairo-test.c test/clip-nesting.c test/clip-operator.c test/clip-zero.c test/device-offset.c test/device-offset-positive.c test/get-clip.c test/get-path-extents.c test/invalid-matrix.c test/mask.c test/meta-surface-pattern.c test/operator-clear.c test/operator-source.c test/pixman-rotate.c test/self-copy.c test/source-clip.c test/source-clip-scale.c test/svg-clip.c test/unbounded-operator.c test/.valgrind-suppressions

Chris Wilson ickle at kemper.freedesktop.org
Thu Dec 20 14:21:10 PST 2007


 perf/cairo-perf-cover.c       |    4 +--
 src/cairo-meta-surface.c      |    2 -
 src/cairo-ps-surface.c        |   53 ++++++++++++++++++++++++++----------------
 src/cairo-surface.c           |    8 +++++-
 src/cairo.c                   |   20 ++++++++-------
 test/.valgrind-suppressions   |   37 +++++++++++++++++++++++++++++
 test/cairo-test.c             |    4 ++-
 test/clip-nesting.c           |    2 -
 test/clip-operator.c          |    2 -
 test/clip-zero.c              |    2 -
 test/device-offset-positive.c |    2 -
 test/device-offset.c          |    2 -
 test/get-clip.c               |    2 -
 test/get-path-extents.c       |    2 -
 test/invalid-matrix.c         |    2 -
 test/mask.c                   |    4 +--
 test/meta-surface-pattern.c   |    2 -
 test/operator-clear.c         |    2 -
 test/operator-source.c        |    4 +--
 test/pixman-rotate.c          |    2 -
 test/self-copy.c              |    2 -
 test/source-clip-scale.c      |    2 -
 test/source-clip.c            |    2 -
 test/svg-clip.c               |    2 -
 test/unbounded-operator.c     |    2 -
 25 files changed, 114 insertions(+), 54 deletions(-)

New commits:
commit 7f69c2588b33d415f544c2ee24d85c83a8d7cd69
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Dec 20 21:15:41 2007 +0000

    [cairo-ps-surface] Missing status checks.
    
    Check and propagate the error status.

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 5065d67..3dda7ce 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -596,6 +596,8 @@ _cairo_ps_surface_emit_outline_glyph_data (cairo_ps_surface_t	*surface,
 					  surface->final_stream,
 					  scaled_glyph->path,
 					  CAIRO_LINE_CAP_ROUND);
+    if (status)
+	return status;
 
     _cairo_output_stream_printf (surface->final_stream,
 				 "F\n");
@@ -1567,7 +1569,6 @@ static cairo_status_t
 _analyze_image_transparency (cairo_image_surface_t      *image,
 			     cairo_image_transparency_t *transparency)
 {
-    cairo_status_t status;
     int x, y;
 
     if (image->format == CAIRO_FORMAT_RGB24) {
@@ -1599,9 +1600,8 @@ _analyze_image_transparency (cairo_image_surface_t      *image,
 	    }
 	}
     }
-    status = CAIRO_STATUS_SUCCESS;
 
-    return status;
+    return CAIRO_STATUS_SUCCESS;
 }
 
 static cairo_int_status_t
@@ -1941,10 +1941,8 @@ _cairo_ps_surface_flatten_image_transparency (cairo_ps_surface_t    *surface,
     opaque = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
 					 image->width,
 					 image->height);
-    if (opaque->status) {
-	status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
-	return status;
-    }
+    if (opaque->status)
+	return opaque->status;
 
     _cairo_pattern_init_for_surface (&pattern.surface, &image->base);
 
@@ -1982,8 +1980,8 @@ fail:
 
 static cairo_status_t
 _cairo_ps_surface_emit_base85_string (cairo_ps_surface_t    *surface,
-				      unsigned char 	    *data,
-				      unsigned long 	     length)
+				      unsigned char	    *data,
+				      unsigned long	     length)
 {
     cairo_output_stream_t *base85_stream, *string_array_stream;
     cairo_status_t status, status2;
@@ -2014,7 +2012,7 @@ static cairo_status_t
 _cairo_ps_surface_emit_image (cairo_ps_surface_t    *surface,
 			      cairo_image_surface_t *image,
 			      const char	    *name,
-			      cairo_operator_t 	     op)
+			      cairo_operator_t	     op)
 {
     cairo_status_t status;
     unsigned char *rgb, *rgb_compressed;
@@ -2040,7 +2038,8 @@ _cairo_ps_surface_emit_image (cairo_ps_surface_t    *surface,
     if (op == CAIRO_OPERATOR_SOURCE ||
 	transparency == CAIRO_IMAGE_HAS_ALPHA ||
 	(transparency == CAIRO_IMAGE_HAS_BILEVEL_ALPHA &&
-	 surface->ps_level == CAIRO_PS_LEVEL_2)) {
+	 surface->ps_level == CAIRO_PS_LEVEL_2))
+    {
 	status = _cairo_ps_surface_flatten_image_transparency (surface,
 							       image,
 							       &opaque_image);
@@ -2248,7 +2247,7 @@ _cairo_ps_surface_emit_image_surface (cairo_ps_surface_t      *surface,
 				      cairo_surface_pattern_t *pattern,
 				      int                     *width,
 				      int                     *height,
-				      cairo_operator_t 	       op)
+				      cairo_operator_t	       op)
 {
     cairo_image_surface_t  *image;
     void		   *image_extra;
@@ -2318,11 +2317,11 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t  *surface,
 }
 
 static void
-_cairo_ps_surface_flatten_transparency (cairo_ps_surface_t 	*surface,
-					const cairo_color_t 	*color,
-					double 			*red,
-					double 			*green,
-					double 			*blue)
+_cairo_ps_surface_flatten_transparency (cairo_ps_surface_t	*surface,
+					const cairo_color_t	*color,
+					double			*red,
+					double			*green,
+					double			*blue)
 {
     *red = color->red;
     *green = color->green;
@@ -2364,7 +2363,7 @@ _cairo_ps_surface_emit_solid_pattern (cairo_ps_surface_t    *surface,
 static cairo_status_t
 _cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t      *surface,
 					cairo_surface_pattern_t *pattern,
-					cairo_operator_t 	 op)
+					cairo_operator_t	 op)
 {
     cairo_status_t status;
     int pattern_width = 0; /* squelch bogus compiler warning */
@@ -2382,9 +2381,13 @@ _cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t      *surface,
 
 	status = _cairo_ps_surface_emit_meta_surface (surface,
 						      meta_surface);
+	if (status)
+	    return status;
+
 	status = _cairo_surface_get_extents (meta_surface, &pattern_extents);
 	if (status)
 	    return status;
+
 	pattern_width = pattern_extents.width;
 	pattern_height = pattern_extents.height;
     } else {
@@ -2981,13 +2984,21 @@ _cairo_ps_surface_stroke (void			*abstract_surface,
     }
 
     status = _cairo_ps_surface_emit_pattern (surface, source, op);
-    if (status)
+    if (status) {
+	if (dash != style->dash)
+	    free (dash);
 	return status;
+    }
 
     _cairo_output_stream_printf (stream,
 				 "gsave\n");
     status = _cairo_ps_surface_emit_path (surface, stream, path,
 					  style->line_cap);
+    if (status) {
+	if (dash != style->dash)
+	    free (dash);
+	return status;
+    }
 
     /*
      * Switch to user space to set line parameters
@@ -3024,7 +3035,8 @@ _cairo_ps_surface_stroke (void			*abstract_surface,
 				 "stroke\n");
     _cairo_output_stream_printf (stream,
 				 "grestore\n");
-    return status;
+
+    return CAIRO_STATUS_SUCCESS;
 }
 
 static cairo_int_status_t
@@ -3134,6 +3146,7 @@ _cairo_ps_surface_show_glyphs (void		     *abstract_surface,
                                                        &subset_glyph);
         if (status)
             goto fail;
+
         glyph_ids[i].subset_id = subset_glyph.subset_id;
         glyph_ids[i].glyph_id = subset_glyph.subset_glyph_index;
     }
commit 51523aec8177224d3f64f55ca2e61c64fe801a56
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Dec 20 21:15:08 2007 +0000

    [cairo-meta-surface] Remove redundant _cairo_error().
    
    Remove the _cairo_error() from the return, as it has already been called
    immediately after the error was first detected.

diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c
index 0b03cc7..89b06bb 100644
--- a/src/cairo-meta-surface.c
+++ b/src/cairo-meta-surface.c
@@ -476,7 +476,7 @@ _cairo_meta_surface_show_glyphs (void			*abstract_surface,
     _cairo_pattern_fini (&command->source.base);
   CLEANUP_COMMAND:
     free (command);
-    return _cairo_error (status);
+    return status;
 }
 
 /**
commit 146484e3122958212d4a69fff97d392451dcbeaa
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Dec 20 21:13:31 2007 +0000

    [valgrind] Update zlib suppressions.
    
    Match the zlib library as found on hardy+dbgsym.

diff --git a/test/.valgrind-suppressions b/test/.valgrind-suppressions
index 5d2b5c1..d791526 100644
--- a/test/.valgrind-suppressions
+++ b/test/.valgrind-suppressions
@@ -83,6 +83,43 @@
    fun:_cairo_pdf_surface_paint
 }
 {
+   cairo's _cairo_pdf_surface_paint triggers apparent bugs in libz
+   Memcheck:Cond
+   fun:deflate_slow
+   fun:deflate
+}
+{
+   cairo's _cairo_pdf_surface_paint triggers apparent bugs in libz
+   Memcheck:Value4
+   fun:deflate_slow
+   fun:deflate
+}
+{
+   cairo's _cairo_pdf_surface_paint triggers apparent bugs in libz
+   Memcheck:Value4
+   fun:compress_block
+   fun:_tr_flush_block
+   fun:deflate_slow
+   fun:deflate
+}
+{
+   cairo's _cairo_pdf_surface_paint triggers apparent bugs in libz
+   Memcheck:Value4
+   fun:crc32
+   obj:/usr/lib/libpng12.so.0.15.0
+   fun:png_write_chunk_data
+   fun:png_write_chunk
+}
+{
+   cairo's _cairo_pdf_surface_paint triggers apparent bugs in libz
+   Memcheck:Value4
+   fun:base64_write_func
+   fun:stream_write_func
+   obj:/usr/lib/libpng12.so.0.15.0
+   fun:png_write_chunk_data
+   fun:png_write_chunk
+}
+{
    pthread initialization strstr bug
    Memcheck:Cond
    fun:strstr
commit d4d3873bccea82bb3ae20bfcbab3158fa5df41b3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Dec 20 18:21:46 2007 +0000

    [cairo] Correct the documentation for cairo_get_group_target().
    
    cairo_get_group_target() can never return NULL, but will always
    return the current destination surface.

diff --git a/src/cairo.c b/src/cairo.c
index a319792..617cd25 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -3326,17 +3326,19 @@ cairo_get_target (cairo_t *cr)
  * cairo_get_group_target:
  * @cr: a cairo context
  *
- * Gets the target surface for the current group as started by the
- * most recent call to cairo_push_group() or
- * cairo_push_group_with_content().
+ * Gets the current destination surface for the context. This is either
+ * the original target surface as passed to cairo_create() or the target
+ * surface for the current group as started by the most recent call to
+ * cairo_push_group() or cairo_push_group_with_content().
  *
- * This function will return NULL if called "outside" of any group
- * rendering blocks, (that is, after the last balancing call to
- * cairo_pop_group() or cairo_pop_group_to_source()).
+ * This function will always return a valid pointer, but the result
+ * can be a "nil" surface if @cr is already in an error state,
+ * (ie. cairo_status() <literal>!=</literal> %CAIRO_STATUS_SUCCESS).
+ * A nil surface is indicated by cairo_surface_status()
+ * <literal>!=</literal> %CAIRO_STATUS_SUCCESS.
  *
- * Return value: the target group surface, or NULL if none.  This
- * object is owned by cairo. To keep a reference to it, you must call
- * cairo_surface_reference().
+ * Return value: the target surface. This object is owned by cairo. To
+ * keep a reference to it, you must call cairo_surface_reference().
  *
  * Since: 1.2
  **/
commit 3bf06c336629d9a485fdb150058897e5a6a30b45
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Dec 20 18:15:48 2007 +0000

    [test/*] Create new surfaces using the group target.
    
    cairo_get_target() returns the original surface passed to
    cairo_create(), and not the current destination as required when
    testing drawing to the same surface using multiple contexts.
    
    For completeness we also use the group target when creating similar
    surfaces within the tests (to check that similar surfaces of similar
    surfaces also work).

diff --git a/perf/cairo-perf-cover.c b/perf/cairo-perf-cover.c
index 53dc7b7..bd12f07 100644
--- a/perf/cairo-perf-cover.c
+++ b/perf/cairo-perf-cover.c
@@ -103,7 +103,7 @@ set_source_similar_surface_rgb (cairo_t	*cr,
 {
     cairo_surface_t *source;
 
-    source = cairo_surface_create_similar (cairo_get_target (cr),
+    source = cairo_surface_create_similar (cairo_get_group_target (cr),
 					   CAIRO_CONTENT_COLOR,
 					   width, height);
     init_and_set_source_surface (cr, source, width, height);
@@ -118,7 +118,7 @@ set_source_similar_surface_rgba (cairo_t	*cr,
 {
     cairo_surface_t *source;
 
-    source = cairo_surface_create_similar (cairo_get_target (cr),
+    source = cairo_surface_create_similar (cairo_get_group_target (cr),
 					   CAIRO_CONTENT_COLOR_ALPHA,
 					   width, height);
     init_and_set_source_surface (cr, source, width, height);
diff --git a/test/cairo-test.c b/test/cairo-test.c
index 9e1bdfe..8fbd5e3 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -241,7 +241,7 @@ cairo_test_target_has_similar (const cairo_test_t *test, cairo_boilerplate_targe
 	cairo_t * cr = cairo_create (surface);
 	cairo_surface_t *similar;
 	cairo_push_group_with_content (cr, target->content);
-	similar = cairo_get_target (cr);
+	similar = cairo_get_group_target (cr);
 	has_similar = cairo_surface_get_type (similar) == cairo_surface_get_type (surface);
 
 	cairo_destroy (cr);
diff --git a/test/clip-nesting.c b/test/clip-nesting.c
index 2d53782..09f77fd 100644
--- a/test/clip-nesting.c
+++ b/test/clip-nesting.c
@@ -46,7 +46,7 @@ draw (cairo_t *cr, int width, int height)
     cairo_surface_t *target_surface;
     cairo_t *cr2, *cr3;
 
-    target_surface = cairo_get_target (cr);
+    target_surface = cairo_get_group_target (cr);
 
     cr2 = cairo_create (target_surface);
 
diff --git a/test/clip-operator.c b/test/clip-operator.c
index 0745e16..3bfb5ba 100644
--- a/test/clip-operator.c
+++ b/test/clip-operator.c
@@ -42,7 +42,7 @@ draw_mask (cairo_t *cr, int x, int y)
     x += 0.05 * WIDTH;
     y += 0.05 * HEIGHT;
 
-    mask_surface = cairo_surface_create_similar (cairo_get_target (cr),
+    mask_surface = cairo_surface_create_similar (cairo_get_group_target (cr),
 						 CAIRO_CONTENT_ALPHA,
 						 width, height);
     cr2 = cairo_create (mask_surface);
diff --git a/test/clip-zero.c b/test/clip-zero.c
index ec2dcc8..bf96d8c 100644
--- a/test/clip-zero.c
+++ b/test/clip-zero.c
@@ -60,7 +60,7 @@ draw (cairo_t *cr, int width, int height)
 
     cairo_mask (cr, cairo_get_source (cr));
 
-    surf = cairo_surface_create_similar (cairo_get_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 0, 0);
+    surf = cairo_surface_create_similar (cairo_get_group_target (cr), CAIRO_CONTENT_COLOR_ALPHA, 0, 0);
     pat = cairo_pattern_create_for_surface (surf);
     cairo_surface_destroy (surf);
 
diff --git a/test/device-offset-positive.c b/test/device-offset-positive.c
index 9080612..ab1adcf 100644
--- a/test/device-offset-positive.c
+++ b/test/device-offset-positive.c
@@ -59,7 +59,7 @@ draw (cairo_t *cr, int width, int height)
     draw_square (cr);
 
     /* Then, create an offset surface and repeat the drawing in red. */
-    target = cairo_get_target (cr);
+    target = cairo_get_group_target (cr);
     surface = cairo_surface_create_similar (target,
 					    cairo_surface_get_content (target),
 					    SIZE / 2, SIZE / 2);
diff --git a/test/device-offset.c b/test/device-offset.c
index 5f0eb80..cee603f 100644
--- a/test/device-offset.c
+++ b/test/device-offset.c
@@ -59,7 +59,7 @@ draw (cairo_t *cr, int width, int height)
     draw_square (cr);
 
     /* Then, create an offset surface and repeat the drawing in red. */
-    target = cairo_get_target (cr);
+    target = cairo_get_group_target (cr);
     surface = cairo_surface_create_similar (target,
 					    cairo_surface_get_content (target),
 					    SIZE / 2, SIZE / 2);
diff --git a/test/get-clip.c b/test/get-clip.c
index 0de84e9..bd92e1e 100644
--- a/test/get-clip.c
+++ b/test/get-clip.c
@@ -119,7 +119,7 @@ draw (cairo_t *cr, int width, int height)
     const char             *phase;
     cairo_bool_t            uses_clip_rects;
     
-    surface = cairo_surface_create_similar (cairo_get_target (cr),
+    surface = cairo_surface_create_similar (cairo_get_group_target (cr),
                                             CAIRO_CONTENT_COLOR, 100, 100);
     /* don't use cr accidentally */
     cr = NULL;
diff --git a/test/get-path-extents.c b/test/get-path-extents.c
index b5af7fa..917039e 100644
--- a/test/get-path-extents.c
+++ b/test/get-path-extents.c
@@ -105,7 +105,7 @@ draw (cairo_t *cr, int width, int height)
     cairo_text_extents_t extents;
     cairo_test_status_t ret = CAIRO_TEST_SUCCESS;
 
-    surface = cairo_surface_create_similar (cairo_get_target (cr),
+    surface = cairo_surface_create_similar (cairo_get_group_target (cr),
                                             CAIRO_CONTENT_COLOR, 100, 100);
     /* don't use cr accidentally */
     cr = NULL;
diff --git a/test/invalid-matrix.c b/test/invalid-matrix.c
index d6b4f50..8a5a9bf 100644
--- a/test/invalid-matrix.c
+++ b/test/invalid-matrix.c
@@ -77,7 +77,7 @@ if ((status) == CAIRO_STATUS_SUCCESS) {							\
 
     cairo_matrix_init_identity (&identity);
 
-    target = cairo_get_target (cr);
+    target = cairo_get_group_target (cr);
 
     /* test cairo_transform with invalid matrix */
     cr2 = cairo_create (target);
diff --git a/test/mask.c b/test/mask.c
index 984b82d..14dd8b3 100644
--- a/test/mask.c
+++ b/test/mask.c
@@ -75,7 +75,7 @@ mask_polygon (cairo_t *cr, int x, int y)
     cairo_surface_t *mask_surface;
     cairo_t *cr2;
 
-    mask_surface = cairo_surface_create_similar (cairo_get_target (cr),
+    mask_surface = cairo_surface_create_similar (cairo_get_group_target (cr),
 						 CAIRO_CONTENT_ALPHA,
 						 WIDTH, HEIGHT);
     cr2 = cairo_create (mask_surface);
@@ -199,7 +199,7 @@ draw (cairo_t *cr, int width, int height)
     /* Some of our drawing is unbounded, so we draw each test to
      * a temporary surface and copy over.
      */
-    tmp_surface = cairo_surface_create_similar (cairo_get_target (cr),
+    tmp_surface = cairo_surface_create_similar (cairo_get_group_target (cr),
 						CAIRO_CONTENT_COLOR_ALPHA,
 						IMAGE_WIDTH, IMAGE_HEIGHT);
     cr2 = cairo_create (tmp_surface);
diff --git a/test/meta-surface-pattern.c b/test/meta-surface-pattern.c
index 4d280c7..a047b3e 100644
--- a/test/meta-surface-pattern.c
+++ b/test/meta-surface-pattern.c
@@ -58,7 +58,7 @@ draw (cairo_t *cr, int width, int height)
 
     cairo_translate (cr, PAD, PAD);
 
-    pat_surface = cairo_surface_create_similar (cairo_get_target (cr),
+    pat_surface = cairo_surface_create_similar (cairo_get_group_target (cr),
 						CAIRO_CONTENT_COLOR_ALPHA,
 						PAT_WIDTH, PAT_HEIGHT);
 
diff --git a/test/operator-clear.c b/test/operator-clear.c
index d076047..e6cb042 100644
--- a/test/operator-clear.c
+++ b/test/operator-clear.c
@@ -61,7 +61,7 @@ draw_mask (cairo_t *cr, int x, int y)
     x += 0.05 * WIDTH;
     y += 0.05 * HEIGHT;
 
-    mask_surface = cairo_surface_create_similar (cairo_get_target (cr),
+    mask_surface = cairo_surface_create_similar (cairo_get_group_target (cr),
 						 CAIRO_CONTENT_ALPHA,
 						 width, height);
     cr2 = cairo_create (mask_surface);
diff --git a/test/operator-source.c b/test/operator-source.c
index 4224c15..e63bcea 100644
--- a/test/operator-source.c
+++ b/test/operator-source.c
@@ -67,7 +67,7 @@ set_surface_pattern (cairo_t *cr, int x, int y)
     x += 0.2 * WIDTH;
     y += 0.2 * HEIGHT;
 
-    source_surface = cairo_surface_create_similar (cairo_get_target (cr),
+    source_surface = cairo_surface_create_similar (cairo_get_group_target (cr),
 						   CAIRO_CONTENT_COLOR_ALPHA,
 						   width, height);
     cr2 = cairo_create (source_surface);
@@ -98,7 +98,7 @@ draw_mask (cairo_t *cr, int x, int y)
     x += 0.05 * WIDTH;
     y += 0.05 * HEIGHT;
 
-    mask_surface = cairo_surface_create_similar (cairo_get_target (cr),
+    mask_surface = cairo_surface_create_similar (cairo_get_group_target (cr),
 						 CAIRO_CONTENT_ALPHA,
 						 width, height);
     cr2 = cairo_create (mask_surface);
diff --git a/test/pixman-rotate.c b/test/pixman-rotate.c
index 118b82e..4d8e300 100644
--- a/test/pixman-rotate.c
+++ b/test/pixman-rotate.c
@@ -55,7 +55,7 @@ draw (cairo_t *cr, int width, int height)
     cairo_surface_t *stamp;
     cairo_t *cr2;
 
-    stamp = cairo_surface_create_similar (cairo_get_target (cr),
+    stamp = cairo_surface_create_similar (cairo_get_group_target (cr),
 					  CAIRO_CONTENT_COLOR_ALPHA,
 					  WIDTH, HEIGHT);
     cr2 = cairo_create (stamp);
diff --git a/test/self-copy.c b/test/self-copy.c
index 0c23855..63e1897 100644
--- a/test/self-copy.c
+++ b/test/self-copy.c
@@ -58,7 +58,7 @@ draw (cairo_t *cr, int width, int height)
     /* Create a pattern with the target surface as the source,
      * offset by SIZE/2
      */
-    pattern = cairo_pattern_create_for_surface (cairo_get_target (cr));
+    pattern = cairo_pattern_create_for_surface (cairo_get_group_target (cr));
 
     cairo_matrix_init_translate (&matrix, - SIZE / 2, - SIZE / 2);
     cairo_pattern_set_matrix (pattern, &matrix);
diff --git a/test/source-clip-scale.c b/test/source-clip-scale.c
index cc24969..26684d3 100644
--- a/test/source-clip-scale.c
+++ b/test/source-clip-scale.c
@@ -44,7 +44,7 @@ draw (cairo_t *cr, int width, int height)
     cairo_surface_t *source;
     cairo_t *cr2;
 
-    source = cairo_surface_create_similar (cairo_get_target (cr),
+    source = cairo_surface_create_similar (cairo_get_group_target (cr),
 					   CAIRO_CONTENT_COLOR_ALPHA,
 					   SIZE, SIZE);
     cr2 = cairo_create (source);
diff --git a/test/source-clip.c b/test/source-clip.c
index cb9386a..46eb233 100644
--- a/test/source-clip.c
+++ b/test/source-clip.c
@@ -44,7 +44,7 @@ draw (cairo_t *cr, int width, int height)
     cairo_surface_t *source;
     cairo_t *cr2;
 
-    source = cairo_surface_create_similar (cairo_get_target (cr),
+    source = cairo_surface_create_similar (cairo_get_group_target (cr),
 					   CAIRO_CONTENT_COLOR_ALPHA,
 					   SIZE, SIZE);
 
diff --git a/test/svg-clip.c b/test/svg-clip.c
index 81af104..338f28f 100644
--- a/test/svg-clip.c
+++ b/test/svg-clip.c
@@ -76,7 +76,7 @@ test_clip (cairo_t *cr, double width, double height)
 
     /* Create a new context for this surface to test overlapped
      * drawing from two contexts */
-    cr2 = cairo_create (cairo_get_target (cr));
+    cr2 = cairo_create (cairo_get_group_target (cr));
 
     /* Using the new context, draw a black vertical line, which should
      * appear unclipped on top of everything drawn so far. */
diff --git a/test/unbounded-operator.c b/test/unbounded-operator.c
index e04ec80..06f5cb1 100644
--- a/test/unbounded-operator.c
+++ b/test/unbounded-operator.c
@@ -43,7 +43,7 @@ draw_mask (cairo_t *cr, int x, int y)
     x += 0.05 * WIDTH;
     y += 0.05 * HEIGHT;
 
-    mask_surface = cairo_surface_create_similar (cairo_get_target (cr),
+    mask_surface = cairo_surface_create_similar (cairo_get_group_target (cr),
 						 CAIRO_CONTENT_ALPHA,
 						 width, height);
     cr2 = cairo_create (mask_surface);
commit 643834e7aa3e90678276453439017359ef942c9e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Dec 20 17:51:48 2007 +0000

    [cairo-surface] Return UNSUPPORTED for acquire_(dest|source)_image.
    
    If the backend does not support fallbacks ie backend->acquire_dest_image
    or backend->acquire_source_image is NULL, then return
    CAIRO_INT_STATUS_UNSUPPORTED rather than attempt to jump to the NULL
    hooks.

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index fe03b8c..e68880a 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -931,7 +931,7 @@ _cairo_surface_has_device_transform (cairo_surface_t *surface)
  * @surface as a source. _cairo_surface_release_source_image() must be called
  * when finished.
  *
- * Return value: %CAIRO_STATUS_SUCCESS if a an image was stored in @image_out.
+ * Return value: %CAIRO_STATUS_SUCCESS if an image was stored in @image_out.
  * %CAIRO_INT_STATUS_UNSUPPORTED if an image cannot be retrieved for the specified
  * surface. Or %CAIRO_STATUS_NO_MEMORY.
  **/
@@ -942,6 +942,9 @@ _cairo_surface_acquire_source_image (cairo_surface_t         *surface,
 {
     assert (!surface->finished);
 
+    if (surface->backend->acquire_source_image == NULL)
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
     return _cairo_surface_set_error (surface,
 	    surface->backend->acquire_source_image (surface,
 						    image_out, image_extra));
@@ -1005,6 +1008,9 @@ _cairo_surface_acquire_dest_image (cairo_surface_t         *surface,
 {
     assert (!surface->finished);
 
+    if (surface->backend->acquire_dest_image == NULL)
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
     return _cairo_surface_set_error (surface,
 	    surface->backend->acquire_dest_image (surface,
 						  interest_rect,
commit 14454e12d8df606ed4b79c6e7cda4071b00ee581
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Dec 20 17:49:06 2007 +0000

    [cairo-test] Wrap test function with cairo_save/restore().
    
    Restore the context to the original state before blitting the
    group surface in order to remove any residual state such as a clip path.

diff --git a/test/cairo-test.c b/test/cairo-test.c
index d262dbb..9e1bdfe 100644
--- a/test/cairo-test.c
+++ b/test/cairo-test.c
@@ -373,7 +373,9 @@ cairo_test_for_target (cairo_test_t			 *test,
     cairo_set_font_options (cr, font_options);
     cairo_font_options_destroy (font_options);
 
+    cairo_save (cr);
     status = (test->draw) (cr, test->width, test->height);
+    cairo_restore (cr);
 
     /* Then, check all the different ways it could fail. */
     if (status) {


More information about the cairo-commit mailing list