[cairo-commit] 5 commits - boilerplate/cairo-boilerplate-test-surfaces.c src/cairo-polygon-intersect.c src/cairo-surface-observer.c src/cairo-win32-font.c src/cairo-win32-printing-surface.c src/cairo-win32-private.h src/cairo-win32-surface.c test/Makefile.refs test/random-clips.c test/reference

Chris Wilson ickle at kemper.freedesktop.org
Mon Sep 26 05:33:46 PDT 2011


 boilerplate/cairo-boilerplate-test-surfaces.c    |    9 
 dev/null                                         |binary
 src/cairo-polygon-intersect.c                    |   28 --
 src/cairo-surface-observer.c                     |   13 +
 src/cairo-win32-font.c                           |   16 -
 src/cairo-win32-printing-surface.c               |   13 -
 src/cairo-win32-private.h                        |   16 -
 src/cairo-win32-surface.c                        |  246 -----------------------
 test/Makefile.refs                               |    4 
 test/random-clips.c                              |   15 +
 test/reference/random-clip.base.argb32.xfail.png |binary
 test/reference/random-clip.base.rgb24.xfail.png  |binary
 test/reference/random-clip.ref.png               |binary
 test/reference/random-clip.traps.argb32.ref.png  |binary
 test/reference/random-clip.traps.rgb24.ref.png   |binary
 15 files changed, 61 insertions(+), 299 deletions(-)

New commits:
commit 303893681f284c734a078012e6521ebb627a54d6
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Sep 26 13:26:33 2011 +0100

    test/random-clips: Paint clip to highlight the issues
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/Makefile.refs b/test/Makefile.refs
index 89eb3f0..1297833 100644
--- a/test/Makefile.refs
+++ b/test/Makefile.refs
@@ -2016,8 +2016,8 @@ REFERENCE_IMAGES = \
 	reference/radial-gradient.traps.argb32.ref.png \
 	reference/radial-gradient.traps.rgb24.ref.png \
 	reference/radial-outer-focus.xfail.png \
-	reference/random-clip.base.argb32.ref.png \
-	reference/random-clip.base.rgb24.ref.png \
+	reference/random-clip.base.argb32.xfail.png \
+	reference/random-clip.base.rgb24.xfail.png \
 	reference/random-clip.ref.png \
 	reference/random-clip.traps.argb32.ref.png \
 	reference/random-clip.traps.rgb24.ref.png \
diff --git a/test/random-clips.c b/test/random-clips.c
index 9fed28e..31d7d6d 100644
--- a/test/random-clips.c
+++ b/test/random-clips.c
@@ -150,6 +150,9 @@ draw (cairo_t *cr, int width, int height)
 	cairo_clip (cr);
 
 	nz_fill_stroke (cr);
+
+	cairo_set_source_rgba (cr, 1, 1, 1, 0.5);
+	cairo_paint (cr);
     } cairo_restore (cr);
 
     cairo_translate (cr, STEP, 0);
@@ -162,6 +165,9 @@ draw (cairo_t *cr, int width, int height)
 	cairo_clip (cr);
 
 	nz_fill_stroke (cr);
+
+	cairo_set_source_rgba (cr, 1, 1, 1, 0.5);
+	cairo_paint (cr);
     } cairo_restore (cr);
 
     cairo_translate (cr, -2*STEP, STEP);
@@ -174,6 +180,9 @@ draw (cairo_t *cr, int width, int height)
 	cairo_clip (cr);
 
 	nz_fill_stroke (cr);
+
+	cairo_set_source_rgba (cr, 1, 1, 1, 0.5);
+	cairo_paint (cr);
     } cairo_restore (cr);
 
     cairo_translate (cr, STEP, 0);
@@ -186,6 +195,9 @@ draw (cairo_t *cr, int width, int height)
 	cairo_clip (cr);
 
 	nz_fill_stroke (cr);
+
+	cairo_set_source_rgba (cr, 1, 1, 1, 0.5);
+	cairo_paint (cr);
     } cairo_restore (cr);
 
     cairo_translate (cr, STEP, 0);
@@ -204,6 +216,9 @@ draw (cairo_t *cr, int width, int height)
 	cairo_clip (cr);
 
 	nz_fill_stroke (cr);
+
+	cairo_set_source_rgba (cr, 1, 1, 1, 0.5);
+	cairo_paint (cr);
     } cairo_restore (cr);
 
     return CAIRO_TEST_SUCCESS;
diff --git a/test/reference/random-clip.base.argb32.ref.png b/test/reference/random-clip.base.argb32.ref.png
deleted file mode 100644
index 43a49ce..0000000
Binary files a/test/reference/random-clip.base.argb32.ref.png and /dev/null differ
diff --git a/test/reference/random-clip.base.argb32.xfail.png b/test/reference/random-clip.base.argb32.xfail.png
new file mode 100644
index 0000000..15f9158
Binary files /dev/null and b/test/reference/random-clip.base.argb32.xfail.png differ
diff --git a/test/reference/random-clip.base.rgb24.ref.png b/test/reference/random-clip.base.rgb24.ref.png
deleted file mode 100644
index 43a49ce..0000000
Binary files a/test/reference/random-clip.base.rgb24.ref.png and /dev/null differ
diff --git a/test/reference/random-clip.base.rgb24.xfail.png b/test/reference/random-clip.base.rgb24.xfail.png
new file mode 100644
index 0000000..15f9158
Binary files /dev/null and b/test/reference/random-clip.base.rgb24.xfail.png differ
diff --git a/test/reference/random-clip.ref.png b/test/reference/random-clip.ref.png
index 573d638..374d6fe 100644
Binary files a/test/reference/random-clip.ref.png and b/test/reference/random-clip.ref.png differ
diff --git a/test/reference/random-clip.traps.argb32.ref.png b/test/reference/random-clip.traps.argb32.ref.png
index 573d638..374d6fe 100644
Binary files a/test/reference/random-clip.traps.argb32.ref.png and b/test/reference/random-clip.traps.argb32.ref.png differ
diff --git a/test/reference/random-clip.traps.rgb24.ref.png b/test/reference/random-clip.traps.rgb24.ref.png
index 573d638..374d6fe 100644
Binary files a/test/reference/random-clip.traps.rgb24.ref.png and b/test/reference/random-clip.traps.rgb24.ref.png differ
commit 9fe7022790478cfcd10a13390a6686497f2c9339
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Sep 26 13:25:58 2011 +0100

    polygon-intersect: Remove surplus edge direction
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-polygon-intersect.c b/src/cairo-polygon-intersect.c
index d9d0cf2..92becd0 100644
--- a/src/cairo-polygon-intersect.c
+++ b/src/cairo-polygon-intersect.c
@@ -59,7 +59,6 @@ typedef struct _cairo_bo_edge cairo_bo_edge_t;
 typedef struct _cairo_bo_deferred {
     cairo_bo_edge_t *other;
     int32_t top;
-    int dir;
 } cairo_bo_deferred_t;
 
 struct _cairo_bo_edge {
@@ -1157,41 +1156,30 @@ edges_end (cairo_bo_edge_t	*left,
 {
     cairo_bo_deferred_t *l = &left->deferred;
     cairo_bo_edge_t *right = l->other;
-    cairo_bo_deferred_t *r = &right->deferred;
 
+    assert(right->deferred.other == NULL);
     if (likely (l->top < bot)) {
-	_cairo_polygon_add_line (polygon, &left->edge.line,
-				 l->top, bot, l->dir);
-	_cairo_polygon_add_line (polygon, &right->edge.line,
-				 l->top, bot, r->dir);
+	_cairo_polygon_add_line (polygon, &left->edge.line, l->top, bot, 1);
+	_cairo_polygon_add_line (polygon, &right->edge.line, l->top, bot, -1);
     }
 
     l->other = NULL;
-    r->other = NULL;
 }
 
-
 static inline void
 edges_start_or_continue (cairo_bo_edge_t	*left,
 			 cairo_bo_edge_t	*right,
 			 int			 top,
 			 cairo_polygon_t	*polygon)
 {
-    if (left->deferred.other == right) {
-	assert (right->deferred.other == left);
-	assert (left->deferred.dir == 1);
-	assert (right->deferred.dir == -1);
+    if (left->deferred.other == right)
 	return;
-    }
 
     if (left->deferred.other != NULL) {
-	assert (left->deferred.dir == 1);
 	if (right != NULL && edges_colinear (left->deferred.other, right)) {
 	    /* continuation on right, so just swap edges */
-	    left->deferred.other->deferred.other = NULL;
+	    assert (left->deferred.other->deferred.other == NULL);
 	    left->deferred.other = right;
-	    right->deferred.other = left;
-	    right->deferred.dir = -1;
 	    return;
 	}
 
@@ -1200,12 +1188,7 @@ edges_start_or_continue (cairo_bo_edge_t	*left,
 
     if (right != NULL && ! edges_colinear (left, right)) {
 	left->deferred.top = top;
-	left->deferred.dir = 1;
 	left->deferred.other = right;
-
-	right->deferred.top = top;
-	right->deferred.dir = -1;
-	right->deferred.other = left;
     }
 }
 
@@ -1260,7 +1243,6 @@ active_edges (cairo_bo_edge_t		*left,
 	}
 }
 
-
 static cairo_status_t
 intersection_sweep (cairo_bo_event_t   **start_events,
 		    int			 num_events,
commit 1a1b39a9c35f8857e8ad36dc02c02ea5eae26021
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Sep 26 10:51:03 2011 +0100

    script: compile without
    
    The surface observer gained a dependency on script, make it optional.

diff --git a/src/cairo-surface-observer.c b/src/cairo-surface-observer.c
index f2c4164..22909e1 100644
--- a/src/cairo-surface-observer.c
+++ b/src/cairo-surface-observer.c
@@ -45,10 +45,13 @@
 #include "cairo-pattern-private.h"
 #include "cairo-output-stream-private.h"
 #include "cairo-recording-surface-private.h"
-#include "cairo-script-private.h"
 #include "cairo-surface-subsurface-private.h"
 #include "cairo-reference-count-private.h"
 
+#if CAIRO_HAS_SCRIPT_SURFACE
+#include "cairo-script-private.h"
+#endif
+
 static const cairo_surface_backend_t _cairo_surface_observer_backend;
 
 /* observation/stats */
@@ -1767,6 +1770,7 @@ replay_record (cairo_observation_t *log,
 	       cairo_observation_record_t *r,
 	       cairo_device_t *script)
 {
+#if CAIRO_HAS_SCRIPT_SURFACE
     cairo_surface_t *surface;
     cairo_int_status_t status;
 
@@ -1784,6 +1788,9 @@ replay_record (cairo_observation_t *log,
     assert (status == CAIRO_INT_STATUS_SUCCESS);
 
     return TRUE;
+#else
+    return FALSE;
+#endif
 }
 
 static cairo_time_t
@@ -1807,8 +1814,12 @@ _cairo_observation_print (cairo_output_stream_t *stream,
     cairo_device_t *script;
     cairo_time_t total;
 
+#if CAIRO_HAS_SCRIPT_SURFAC
     script = _cairo_script_context_create_internal (stream);
     _cairo_script_context_attach_snapshots (script, FALSE);
+#else
+    script = NULL;
+#endif
 
     total = _cairo_observation_total_elapsed (log);
 
commit bbacfc4e836ab09896b0ca3da9d90b582e35748c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Sep 26 10:27:23 2011 +0100

    win32: Compile, but broken
    
    First step: just make it compile again but crash upon usage.

diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index fb01665..73fc052 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -45,6 +45,8 @@
 #include "cairoint.h"
 
 #include "cairo-win32-private.h"
+
+#include "cairo-array-private.h"
 #include "cairo-error-private.h"
 #include "cairo-image-surface-private.h"
 #include "cairo-pattern-private.h"
@@ -1388,6 +1390,7 @@ _cairo_win32_scaled_font_glyph_init (void		       *abstract_font,
     return CAIRO_STATUS_SUCCESS;
 }
 
+#if 0
 static cairo_int_status_t
 _cairo_win32_scaled_font_show_glyphs (void			*abstract_font,
 				      cairo_operator_t		 op,
@@ -1496,13 +1499,7 @@ _cairo_win32_scaled_font_show_glyphs (void			*abstract_font,
 	if (scaled_font->quality == CLEARTYPE_QUALITY)
 	    mask.base.has_component_alpha = TRUE;
 
-	status = _cairo_surface_composite (op, pattern,
-					   &mask.base,
-					   &surface->base,
-					   source_x, source_y,
-					   0, 0,
-					   dest_x, dest_y,
-					   width, height,
+	status = _cairo_surface_mask (&surface->base, op, pattern, &mask.base,
 					   clip_region);
 
 	_cairo_pattern_fini (&mask.base);
@@ -1510,6 +1507,7 @@ _cairo_win32_scaled_font_show_glyphs (void			*abstract_font,
 	return status;
     }
 }
+#endif
 
 static cairo_int_status_t
 _cairo_win32_scaled_font_load_truetype_table (void	       *abstract_font,
@@ -1963,7 +1961,6 @@ const cairo_scaled_font_backend_t _cairo_win32_scaled_font_backend = {
     _cairo_win32_scaled_font_glyph_init,
     NULL, /* _cairo_win32_scaled_font_text_to_glyphs, FIXME */
     _cairo_win32_scaled_font_ucs4_to_index,
-    _cairo_win32_scaled_font_show_glyphs,
     _cairo_win32_scaled_font_load_truetype_table,
     _cairo_win32_scaled_font_index_to_ucs4,
     _cairo_win32_scaled_font_is_synthetic,
@@ -2218,14 +2215,11 @@ cairo_win32_font_face_create_for_logfontw_hfont (LOGFONTW *logfont, HFONT font)
     if (unlikely (status))
 	goto FAIL;
 
-DONE:
     _cairo_win32_font_face_hash_table_unlock ();
-
     return &font_face->base;
 
 FAIL:
     _cairo_win32_font_face_hash_table_unlock ();
-
     return (cairo_font_face_t *)&_cairo_font_face_nil;
 }
 
diff --git a/src/cairo-win32-printing-surface.c b/src/cairo-win32-printing-surface.c
index f6ce202..296e626 100644
--- a/src/cairo-win32-printing-surface.c
+++ b/src/cairo-win32-printing-surface.c
@@ -1441,8 +1441,7 @@ _cairo_win32_printing_surface_emit_win32_glyphs (cairo_win32_surface_t 	*surface
 						 cairo_glyph_t        	*glyphs,
 						 int			 num_glyphs,
 						 cairo_scaled_font_t  	*scaled_font,
-						 const cairo_clip_t	*clip,
-						 int			*remaining_glyphs)
+						 const cairo_clip_t	*clip)
 {
     cairo_matrix_t ctm;
     cairo_glyph_t  *unicode_glyphs;
@@ -1504,7 +1503,6 @@ _cairo_win32_printing_surface_emit_win32_glyphs (cairo_win32_surface_t 	*surface
 		i - first + 1,
 		scaled_font,
 		clip,
-		remaining_glyphs,
 		! sequence_is_unicode);
 	    first = i + 1;
 	    if (i < num_glyphs - 1)
@@ -1529,8 +1527,7 @@ _cairo_win32_printing_surface_show_glyphs (void                 *abstract_surfac
                                            cairo_glyph_t        *glyphs,
                                            int			 num_glyphs,
                                            cairo_scaled_font_t  *scaled_font,
-					   const cairo_clip_t	*clip,
-					   int			*remaining_glyphs)
+					   const cairo_clip_t	*clip)
 {
     cairo_win32_surface_t *surface = abstract_surface;
     cairo_status_t status = CAIRO_STATUS_SUCCESS;
@@ -1612,8 +1609,7 @@ _cairo_win32_printing_surface_show_glyphs (void                 *abstract_surfac
 								glyphs,
 								num_glyphs,
 								scaled_font,
-								clip,
-								remaining_glyphs);
+								clip);
     }
 #endif
 
@@ -1885,9 +1881,6 @@ static const cairo_surface_backend_t cairo_win32_printing_surface_backend = {
     NULL, /* flush */
     NULL, /* mark_dirty_rectangle */
 
-    NULL, /* scaled_font_fini */
-    NULL, /* scaled_glyph_fini */
-
     _cairo_win32_printing_surface_paint,
     NULL, /* mask */
     _cairo_win32_printing_surface_stroke,
diff --git a/src/cairo-win32-private.h b/src/cairo-win32-private.h
index e00b38b..07830dc 100644
--- a/src/cairo-win32-private.h
+++ b/src/cairo-win32-private.h
@@ -172,7 +172,6 @@ _cairo_win32_surface_show_glyphs_internal (void			 *surface,
 					   int			  num_glyphs,
 					   cairo_scaled_font_t	 *scaled_font,
 					   const cairo_clip_t	 *clip,
-					   int			 *remaining_glyphs,
 					   cairo_bool_t		  glyph_indices);
 
 cairo_int_status_t
@@ -182,8 +181,7 @@ _cairo_win32_surface_show_glyphs (void			*surface,
 				  cairo_glyph_t		*glyphs,
 				  int			 num_glyphs,
 				  cairo_scaled_font_t	*scaled_font,
-				  const cairo_clip_t	*clip,
-				  int			*remaining_glyphs);
+				  const cairo_clip_t	*clip);
 
 cairo_surface_t *
 _cairo_win32_surface_create_similar (void	    *abstract_src,
@@ -191,18 +189,6 @@ _cairo_win32_surface_create_similar (void	    *abstract_src,
 				     int	     width,
 				     int	     height);
 
-cairo_status_t
-_cairo_win32_surface_clone_similar (void *abstract_surface,
-				    cairo_surface_t *src,
-				    cairo_content_t content,
-				    int src_x,
-				    int src_y,
-				    int width,
-				    int height,
-				    int *clone_offset_x,
-				    int *clone_offset_y,
-				    cairo_surface_t **clone_out);
-
 static inline void
 _cairo_matrix_to_win32_xform (const cairo_matrix_t *m,
                               XFORM *xform)
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 274df3f..c7d3216 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -57,6 +57,7 @@
 #include "cairo-win32-private.h"
 #include "cairo-scaled-font-subsets-private.h"
 #include "cairo-surface-fallback-private.h"
+#include "cairo-surface-backend-private.h"
 
 #include <wchar.h>
 #include <windows.h>
@@ -646,65 +647,6 @@ _cairo_win32_surface_release_source_image (void                   *abstract_surf
 	cairo_surface_destroy ((cairo_surface_t *)local);
 }
 
-static cairo_status_t
-_cairo_win32_surface_acquire_dest_image (void                    *abstract_surface,
-					 cairo_rectangle_int_t   *interest_rect,
-					 cairo_image_surface_t  **image_out,
-					 cairo_rectangle_int_t   *image_rect,
-					 void                   **image_extra)
-{
-    cairo_win32_surface_t *surface = abstract_surface;
-    cairo_win32_surface_t *local = NULL;
-    cairo_status_t status;
-
-    if (surface->image) {
-	GdiFlush();
-
-	*image_out = (cairo_image_surface_t *) surface->image;
-	*image_extra = NULL;
-	*image_rect = surface->extents;
-	return CAIRO_STATUS_SUCCESS;
-    }
-
-    status = _cairo_win32_surface_get_subimage (abstract_surface,
-						interest_rect->x,
-						interest_rect->y,
-						interest_rect->width,
-						interest_rect->height,
-						&local);
-    if (status)
-	return status;
-
-    *image_out = (cairo_image_surface_t *) local->image;
-    *image_extra = local;
-    *image_rect = *interest_rect;
-    return CAIRO_STATUS_SUCCESS;
-}
-
-static void
-_cairo_win32_surface_release_dest_image (void                    *abstract_surface,
-					 cairo_rectangle_int_t   *interest_rect,
-					 cairo_image_surface_t   *image,
-					 cairo_rectangle_int_t   *image_rect,
-					 void                    *image_extra)
-{
-    cairo_win32_surface_t *surface = abstract_surface;
-    cairo_win32_surface_t *local = image_extra;
-
-    if (!local)
-	return;
-
-    if (!BitBlt (surface->dc,
-		 image_rect->x, image_rect->y,
-		 image_rect->width, image_rect->height,
-		 local->dc,
-		 0, 0,
-		 SRCCOPY))
-	_cairo_win32_print_gdi_error ("_cairo_win32_surface_release_dest_image");
-
-    cairo_surface_destroy ((cairo_surface_t *)local);
-}
-
 cairo_status_t
 _cairo_win32_surface_set_clip_region (void           *abstract_surface,
 				      cairo_region_t *region)
@@ -1380,6 +1322,7 @@ UNSUPPORTED:
     if (dst->image) {
 	GdiFlush();
 
+#if 0
 	return dst->image->backend->composite (op, pattern, mask_pattern,
 					       dst->image,
 					       src_x, src_y,
@@ -1387,6 +1330,7 @@ UNSUPPORTED:
 					       dst_x, dst_y,
 					       width, height,
 					       clip_region);
+#endif
     }
 
     return CAIRO_INT_STATUS_UNSUPPORTED;
@@ -1583,7 +1527,6 @@ _cairo_win32_surface_show_glyphs_internal (void			 *surface,
 					   int			  num_glyphs,
 					   cairo_scaled_font_t	 *scaled_font,
 					   const cairo_clip_t	 *clip,
-					   int			 *remaining_glyphs,
 					   cairo_bool_t		  glyph_indexing)
 {
 #if CAIRO_HAS_WIN32_FONT
@@ -1733,8 +1676,7 @@ _cairo_win32_surface_show_glyphs (void			*surface,
 				  cairo_glyph_t		*glyphs,
 				  int			 num_glyphs,
 				  cairo_scaled_font_t	*scaled_font,
-				  const cairo_clip_t          *clip,
-				  int			*remaining_glyphs)
+				  const cairo_clip_t    *clip)
 {
     return _cairo_win32_surface_show_glyphs_internal (surface,
 						      op,
@@ -1743,7 +1685,6 @@ _cairo_win32_surface_show_glyphs (void			*surface,
 						      num_glyphs,
 						      scaled_font,
 						      clip,
-						      remaining_glyphs,
 						      TRUE);
 }
 
@@ -1985,166 +1926,6 @@ cairo_win32_surface_get_image (cairo_surface_t *surface)
     return ((cairo_win32_surface_t*)surface)->image;
 }
 
-static cairo_bool_t
-_cairo_win32_surface_is_similar (void *surface_a,
-	                         void *surface_b)
-{
-    cairo_win32_surface_t *a = surface_a;
-    cairo_win32_surface_t *b = surface_b;
-
-    return a->dc == b->dc;
-}
-
-typedef struct _cairo_win32_surface_span_renderer {
-    cairo_span_renderer_t base;
-
-    cairo_operator_t op;
-    const cairo_pattern_t *pattern;
-    cairo_antialias_t antialias;
-
-    uint8_t *mask_data;
-    uint32_t mask_stride;
-
-    cairo_image_surface_t *mask;
-    cairo_win32_surface_t *dst;
-    cairo_region_t *clip_region;
-
-    cairo_composite_rectangles_t composite_rectangles;
-} cairo_win32_surface_span_renderer_t;
-
-static cairo_status_t
-_cairo_win32_surface_span_renderer_render_rows (
-    void				*abstract_renderer,
-    int					 y,
-    int					 height,
-    const cairo_half_open_span_t	*spans,
-    unsigned				 num_spans)
-{
-    cairo_win32_surface_span_renderer_t *renderer = abstract_renderer;
-    while (height--)
-	_cairo_image_surface_span_render_row (y++, spans, num_spans, renderer->mask_data, renderer->mask_stride);
-    return CAIRO_STATUS_SUCCESS;
-}
-
-static void
-_cairo_win32_surface_span_renderer_destroy (void *abstract_renderer)
-{
-    cairo_win32_surface_span_renderer_t *renderer = abstract_renderer;
-    if (!renderer) return;
-
-    if (renderer->mask != NULL)
-	cairo_surface_destroy (&renderer->mask->base);
-
-    free (renderer);
-}
-
-static cairo_status_t
-_cairo_win32_surface_span_renderer_finish (void *abstract_renderer)
-{
-    cairo_win32_surface_span_renderer_t *renderer = abstract_renderer;
-    cairo_status_t status = CAIRO_STATUS_SUCCESS;
-
-    if (renderer->pattern == NULL || renderer->mask == NULL)
-	return CAIRO_STATUS_SUCCESS;
-
-    status = cairo_surface_status (&renderer->mask->base);
-    if (status == CAIRO_STATUS_SUCCESS) {
-	cairo_composite_rectangles_t *rects = &renderer->composite_rectangles;
-	cairo_win32_surface_t *dst = renderer->dst;
-	cairo_pattern_t *mask_pattern = cairo_pattern_create_for_surface (&renderer->mask->base);
-	/* composite onto the image surface directly if we can */
-	if (dst->image) {
-	    GdiFlush(); /* XXX: I'm not sure if this needed or not */
-
-	    status = dst->image->backend->composite (renderer->op,
-		    renderer->pattern, mask_pattern, dst->image,
-		    rects->bounded.x, rects->bounded.y,
-		    0, 0,		/* mask.x, mask.y */
-		    rects->bounded.x, rects->bounded.y,
-		    rects->bounded.width, rects->bounded.height,
-		    renderer->clip_region);
-	} else {
-	    /* otherwise go through the fallback_composite path which
-	     * will do the appropriate surface acquisition */
-	    status = _cairo_surface_fallback_composite (
-		    renderer->op,
-		    renderer->pattern, mask_pattern, &dst->base,
-		    rects->bounded.x, rects->bounded.y,
-		    0, 0,		/* mask.x, mask.y */
-		    rects->bounded.x, rects->bounded.y,
-		    rects->bounded.width, rects->bounded.height,
-		    renderer->clip_region);
-	}
-	cairo_pattern_destroy (mask_pattern);
-
-    }
-    if (status != CAIRO_STATUS_SUCCESS)
-	return _cairo_span_renderer_set_error (abstract_renderer,
-					       status);
-    return CAIRO_STATUS_SUCCESS;
-}
-
-static cairo_bool_t
-_cairo_win32_surface_check_span_renderer (cairo_operator_t	  op,
-					  const cairo_pattern_t  *pattern,
-					  void			 *abstract_dst,
-					  cairo_antialias_t	  antialias)
-{
-    (void) op;
-    (void) pattern;
-    (void) abstract_dst;
-    (void) antialias;
-    return TRUE;
-}
-
-static cairo_span_renderer_t *
-_cairo_win32_surface_create_span_renderer (cairo_operator_t	 op,
-					   const cairo_pattern_t  *pattern,
-					   void			*abstract_dst,
-					   cairo_antialias_t	 antialias,
-					   const cairo_composite_rectangles_t *rects,
-					   cairo_region_t	*clip_region)
-{
-    cairo_win32_surface_t *dst = abstract_dst;
-    cairo_win32_surface_span_renderer_t *renderer;
-    cairo_status_t status;
-    int width = rects->bounded.width;
-    int height = rects->bounded.height;
-
-    renderer = calloc(1, sizeof(*renderer));
-    if (renderer == NULL)
-	return _cairo_span_renderer_create_in_error (CAIRO_STATUS_NO_MEMORY);
-
-    renderer->base.destroy = _cairo_win32_surface_span_renderer_destroy;
-    renderer->base.finish = _cairo_win32_surface_span_renderer_finish;
-    renderer->base.render_rows = _cairo_win32_surface_span_renderer_render_rows;
-    renderer->op = op;
-    renderer->pattern = pattern;
-    renderer->antialias = antialias;
-    renderer->dst = dst;
-    renderer->clip_region = clip_region;
-
-    renderer->composite_rectangles = *rects;
-
-    /* TODO: support rendering to A1 surfaces (or: go add span
-     * compositing to pixman.) */
-    renderer->mask = (cairo_image_surface_t *)
-	cairo_image_surface_create (CAIRO_FORMAT_A8,
-				    width, height);
-
-    status = cairo_surface_status (&renderer->mask->base);
-
-    if (status != CAIRO_STATUS_SUCCESS) {
-	_cairo_win32_surface_span_renderer_destroy (renderer);
-	return _cairo_span_renderer_create_in_error (status);
-    }
-
-    renderer->mask_data = renderer->mask->data - rects->bounded.x - rects->bounded.y * renderer->mask->stride;
-    renderer->mask_stride = renderer->mask->stride;
-    return &renderer->base;
-}
-
-
 static const cairo_surface_backend_t cairo_win32_surface_backend = {
     CAIRO_SURFACE_TYPE_WIN32,
     _cairo_win32_surface_finish,
@@ -2158,32 +1939,23 @@ static const cairo_surface_backend_t cairo_win32_surface_backend = {
 
     _cairo_win32_surface_acquire_source_image,
     _cairo_win32_surface_release_source_image,
-    _cairo_win32_surface_acquire_dest_image,
-    _cairo_win32_surface_release_dest_image,
-    NULL, /* clone similar */
-    _cairo_win32_surface_composite,
-    _cairo_win32_surface_fill_rectangles,
-    NULL, /* composite_trapezoids */
-    _cairo_win32_surface_create_span_renderer,
-    _cairo_win32_surface_check_span_renderer,
+    NULL,  /* snapshot */
+
     NULL, /* copy_page */
     NULL, /* show_page */
+
     _cairo_win32_surface_get_extents,
-    NULL, /* old_show_glyphs */
     NULL, /* get_font_options */
+
     _cairo_win32_surface_flush,
     NULL, /* mark_dirty_rectangle */
-    NULL, /* scaled_font_fini */
-    NULL, /* scaled_glyph_fini */
 
     NULL, /* paint */
     NULL, /* mask */
     NULL, /* stroke */
     NULL, /* fill */
+    NULL, /* fill/stroke */
     _cairo_win32_surface_show_glyphs,
-
-    NULL,  /* snapshot */
-    _cairo_win32_surface_is_similar,
 };
 
 /* Notes:
commit 4790bbf59681553bd3850c90e409311076431786
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Sep 26 11:51:27 2011 +0100

    boilerplate: Skip testing of null surfaces
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/boilerplate/cairo-boilerplate-test-surfaces.c b/boilerplate/cairo-boilerplate-test-surfaces.c
index 8370de2..73f2503 100644
--- a/boilerplate/cairo-boilerplate-test-surfaces.c
+++ b/boilerplate/cairo-boilerplate-test-surfaces.c
@@ -124,6 +124,9 @@ _cairo_boilerplate_test_no_fallback_compositor_create_surface (const char		   *n
 							       int			    id,
 							       void			  **closure)
 {
+    if (mode == CAIRO_BOILERPLATE_MODE_TEST)
+	return NULL;
+
     *closure = NULL;
     return _cairo_test_no_fallback_compositor_surface_create (content, ceil (width), ceil (height));
 }
@@ -139,6 +142,9 @@ _cairo_boilerplate_test_no_traps_compositor_create_surface (const char		   *name
 							 int			    id,
 							 void			  **closure)
 {
+    if (mode == CAIRO_BOILERPLATE_MODE_TEST)
+	return NULL;
+
     *closure = NULL;
     return _cairo_test_no_traps_compositor_surface_create (content, ceil (width), ceil (height));
 }
@@ -154,6 +160,9 @@ _cairo_boilerplate_test_no_spans_compositor_create_surface (const char		   *name
 							 int			    id,
 							 void			  **closure)
 {
+    if (mode == CAIRO_BOILERPLATE_MODE_TEST)
+	return NULL;
+
     *closure = NULL;
     return _cairo_test_no_spans_compositor_surface_create (content, ceil (width), ceil (height));
 }


More information about the cairo-commit mailing list