[cairo-commit] 7 commits - src/cairo-pattern.c src/cairo-pdf-surface.c src/cairo-svg-surface.c test/Makefile.am test/smask-fill-svg-ref.png test/smask-mask-svg-ref.png test/smask-paint-svg-ref.png test/smask-ps-ref.png test/smask-svg-ref.png test/smask-text-ps-ref.png test/smask-text-svg-ref.png

Carl Worth cworth at kemper.freedesktop.org
Mon Apr 7 16:10:32 PDT 2008


 src/cairo-pattern.c          |   22 -------------------
 src/cairo-pdf-surface.c      |   48 +++++++++++++++++++++----------------------
 src/cairo-svg-surface.c      |   18 ++++++++++++----
 test/Makefile.am             |    8 +++++++
 test/smask-fill-svg-ref.png  |binary
 test/smask-mask-svg-ref.png  |binary
 test/smask-paint-svg-ref.png |binary
 test/smask-ps-ref.png        |binary
 test/smask-svg-ref.png       |binary
 test/smask-text-ps-ref.png   |binary
 test/smask-text-svg-ref.png  |binary
 11 files changed, 46 insertions(+), 50 deletions(-)

New commits:
commit fdcd1445846b59d2ffd1780dd0f6d70169036ad4
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 7 13:30:59 2008 -0700

    Add filter-bilinear-extents to the XFAIL list
    
    This test case does show a bug, and we have lots of ideas on how
    to fix the bug, but we want to wait until after the 1.6 release
    before we fix it. See:
    
    	http://bugs.freedesktop.org/show_bug.cgi?id=15349

diff --git a/test/Makefile.am b/test/Makefile.am
index da7399b..7b4ac7e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -705,6 +705,7 @@ big-line$(EXEEXT)				\
 big-trap$(EXEEXT)				\
 extend-pad$(EXEEXT)				\
 filter-nearest-offset$(EXEEXT)			\
+filter-bilinear-extents$(EXEEXT)		\
 long-lines$(EXEEXT)				\
 self-intersecting$(EXEEXT)			\
 surface-pattern$(EXEEXT)			\
commit 36246c51ba720713ebf93573da29b098e87f0bd0
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 7 12:10:24 2008 -0700

    Revert "_cairo_pattern_get_extents: Fix to allow for expansion based on filter"
    
    This reverts commit 731e121c802a7b1c3429d1bde7a93bc471d70880.
    
    This commit introduced various problems, (some likely noticeable
    in the test suite, and others perhaps not). For some details, see
    the latest comments in the original bug report leading to the
    fix now being reverted:
    
    	http://bugs.freedesktop.org/show_bug.cgi?id=15349

diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 097fc39..682a690 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -1994,28 +1994,6 @@ _cairo_pattern_get_extents (cairo_pattern_t         *pattern,
 	x2 = x1 + surface_extents.width;
 	y2 = y1 + surface_extents.height;
 
-	/* The filter can effectively enlarge the extents of the
-	 * pattern, so extend as necessary. Note: We aren't doing any
-	 * backend-specific querying of filter box sizes at this time,
-	 * (since currently no specific backends that could do custom
-	 * filters are calling _cairo_pattern_get_extents). */
-	switch (pattern->filter) {
-	case CAIRO_FILTER_GOOD:
-	case CAIRO_FILTER_BEST:
-	case CAIRO_FILTER_BILINEAR:
-	    x1 -= 0.5;
-	    y1 -= 0.5;
-	    x2 += 0.5;
-	    y2 += 0.5;
-	    break;
-	case CAIRO_FILTER_FAST:
-	case CAIRO_FILTER_NEAREST:
-	case CAIRO_FILTER_GAUSSIAN:
-	default:
-	    /* Nothing to do */
-	    break;
-	}
-
 	imatrix = pattern->matrix;
 	status = cairo_matrix_invert (&imatrix);
 	/* cairo_pattern_set_matrix ensures the matrix is invertible */
commit c88adb6aee650c8c544b212f539bd5da9ed88734
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 7 16:09:03 2008 -0700

    Add svg-specific reference images for smask and smask-mask
    
    The most recent change for the mask_id allocation fixes these
    two test, (it fixes mask-image-mask as well, but it didn't need
    a new reference image).

diff --git a/test/Makefile.am b/test/Makefile.am
index 0ccaef4..da7399b 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -593,6 +593,7 @@ REFERENCE_IMAGES = \
 	smask-ref.png			\
 	smask-pdf-ref.png		\
 	smask-ps-ref.png		\
+	smask-svg-ref.png		\
 	smask-fill-ref.png		\
 	smask-fill-pdf-ref.png		\
 	smask-fill-svg-ref.png		\
@@ -600,6 +601,7 @@ REFERENCE_IMAGES = \
 	smask-image-mask-pdf-ref.png	\
 	smask-mask-ref.png		\
 	smask-mask-pdf-ref.png		\
+	smask-mask-svg-ref.png		\
 	smask-paint-ref.png		\
 	smask-paint-pdf-ref.png		\
 	smask-paint-svg-ref.png		\
diff --git a/test/smask-mask-svg-ref.png b/test/smask-mask-svg-ref.png
new file mode 100644
index 0000000..0820cd1
Binary files /dev/null and b/test/smask-mask-svg-ref.png differ
diff --git a/test/smask-svg-ref.png b/test/smask-svg-ref.png
new file mode 100644
index 0000000..f188561
Binary files /dev/null and b/test/smask-svg-ref.png differ
commit 164e9c195c16fbed08539b859a06cc6f042fb5d9
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 7 15:50:22 2008 -0700

    SVG: Fix generation of mask_id identifiers
    
    In tests such as smask-mask (and others) the cairo_mask operation
    is used in the construction of a mask. In this case, the single
    document->mask_id value was being incremented at inappropriate
    times.
    
    We fix this by adding a new _cairo_svg_document_allocate_mask_id
    that returns the current value and increments it. That way,
    callers can hold onto this reliable value for the desired lifetime
    that the code needs the identifier.

diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index a900c24..df5253d 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -135,6 +135,9 @@ _cairo_svg_document_finish (cairo_svg_document_t *document);
 static cairo_svg_document_t *
 _cairo_svg_document_reference (cairo_svg_document_t *document);
 
+static unsigned int
+_cairo_svg_document_allocate_mask_id (cairo_svg_document_t *document);
+
 static cairo_surface_t *
 _cairo_svg_surface_create_for_document (cairo_svg_document_t	*document,
 					cairo_content_t		 content,
@@ -2036,6 +2039,7 @@ _cairo_svg_surface_mask (void		    *abstract_surface,
     cairo_output_stream_t *mask_stream;
     char buffer[64];
     cairo_bool_t discard_filter = FALSE;
+    unsigned int mask_id;
 
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return _cairo_svg_surface_analyze_operation (surface, op, source);
@@ -2059,10 +2063,12 @@ _cairo_svg_surface_mask (void		    *abstract_surface,
     if (_cairo_output_stream_get_status (mask_stream))
 	return _cairo_output_stream_destroy (mask_stream);
 
+    mask_id = _cairo_svg_document_allocate_mask_id (document);
+
     _cairo_output_stream_printf (mask_stream,
 				 "<mask id=\"mask%d\">\n"
 				 "%s",
-				 document->mask_id,
+				 mask_id,
 				 discard_filter ? "" : "  <g filter=\"url(#alpha)\">\n");
     status = _cairo_svg_surface_emit_paint (mask_stream, surface, op, mask, NULL);
     if (status) {
@@ -2082,13 +2088,11 @@ _cairo_svg_surface_mask (void		    *abstract_surface,
 	return status;
 
     snprintf (buffer, sizeof buffer, "mask=\"url(#mask%d)\"",
-	      document->mask_id);
+	      mask_id);
     status = _cairo_svg_surface_emit_paint (surface->xml_node, surface, op, source, buffer);
     if (status)
 	return status;
 
-    document->mask_id++;
-
     return CAIRO_STATUS_SUCCESS;
 }
 
@@ -2378,6 +2382,12 @@ _cairo_svg_document_reference (cairo_svg_document_t *document)
     return document;
 }
 
+static unsigned int
+_cairo_svg_document_allocate_mask_id (cairo_svg_document_t *document)
+{
+    return document->mask_id++;
+}
+
 static cairo_status_t
 _cairo_svg_document_destroy (cairo_svg_document_t *document)
 {
commit 8aa306ec08dcf0ae8803cdb1bda0fb31658f9e83
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 7 14:17:40 2008 -0700

    Add svg-specific reference images for smask-fill, smask-paint, and smask-text tests

diff --git a/test/Makefile.am b/test/Makefile.am
index 83cb0cf..0ccaef4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -595,17 +595,20 @@ REFERENCE_IMAGES = \
 	smask-ps-ref.png		\
 	smask-fill-ref.png		\
 	smask-fill-pdf-ref.png		\
+	smask-fill-svg-ref.png		\
 	smask-image-mask-ref.png	\
 	smask-image-mask-pdf-ref.png	\
 	smask-mask-ref.png		\
 	smask-mask-pdf-ref.png		\
 	smask-paint-ref.png		\
 	smask-paint-pdf-ref.png		\
+	smask-paint-svg-ref.png		\
 	smask-stroke-ref.png		\
 	smask-stroke-pdf-ref.png	\
 	smask-text-ref.png		\
 	smask-text-pdf-ref.png		\
 	smask-text-ps-ref.png		\
+	smask-text-svg-ref.png		\
 	stroke-image-ref.png \
 	stroke-image-pdf-ref.png \
 	stroke-image-ps-ref.png \
diff --git a/test/smask-fill-svg-ref.png b/test/smask-fill-svg-ref.png
new file mode 100644
index 0000000..06ab12a
Binary files /dev/null and b/test/smask-fill-svg-ref.png differ
diff --git a/test/smask-paint-svg-ref.png b/test/smask-paint-svg-ref.png
new file mode 100644
index 0000000..09c01de
Binary files /dev/null and b/test/smask-paint-svg-ref.png differ
diff --git a/test/smask-text-svg-ref.png b/test/smask-text-svg-ref.png
new file mode 100644
index 0000000..2665370
Binary files /dev/null and b/test/smask-text-svg-ref.png differ
commit 3d86023281d7d18ad72be85ad8b53c29f20dfc7e
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 7 14:09:32 2008 -0700

    Add ps-specific reference images for smask and smask-text tests

diff --git a/test/Makefile.am b/test/Makefile.am
index 490e42e..83cb0cf 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -592,6 +592,7 @@ REFERENCE_IMAGES = \
 	skew-extreme-ps-ref.png \
 	smask-ref.png			\
 	smask-pdf-ref.png		\
+	smask-ps-ref.png		\
 	smask-fill-ref.png		\
 	smask-fill-pdf-ref.png		\
 	smask-image-mask-ref.png	\
@@ -604,6 +605,7 @@ REFERENCE_IMAGES = \
 	smask-stroke-pdf-ref.png	\
 	smask-text-ref.png		\
 	smask-text-pdf-ref.png		\
+	smask-text-ps-ref.png		\
 	stroke-image-ref.png \
 	stroke-image-pdf-ref.png \
 	stroke-image-ps-ref.png \
diff --git a/test/smask-ps-ref.png b/test/smask-ps-ref.png
new file mode 100644
index 0000000..c006bbd
Binary files /dev/null and b/test/smask-ps-ref.png differ
diff --git a/test/smask-text-ps-ref.png b/test/smask-text-ps-ref.png
new file mode 100644
index 0000000..ae61325
Binary files /dev/null and b/test/smask-text-ps-ref.png differ
commit f2a94c84a160f205ee72cc0c538a556d7d611e7b
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 7 13:03:58 2008 -0700

    Add underscore prefix to private _cairo_pdf_surface_set_size_internal

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 4fb3596..f82af83 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -212,9 +212,9 @@ _cairo_pdf_surface_update_object (cairo_pdf_surface_t	*surface,
 }
 
 static void
-cairo_pdf_surface_set_size_internal (cairo_pdf_surface_t *surface,
-				     double		  width,
-				     double		  height)
+_cairo_pdf_surface_set_size_internal (cairo_pdf_surface_t *surface,
+				      double		  width,
+				      double		  height)
 {
     surface->width = width;
     surface->height = height;
@@ -454,9 +454,9 @@ cairo_pdf_surface_set_size (cairo_surface_t	*surface,
 	return;
     }
 
-    cairo_pdf_surface_set_size_internal (pdf_surface,
-					 width_in_points,
-					 height_in_points);
+    _cairo_pdf_surface_set_size_internal (pdf_surface,
+					  width_in_points,
+					  height_in_points);
     status = _cairo_paginated_surface_set_size (pdf_surface->paginated_surface,
 						width_in_points,
 						height_in_points);
@@ -1507,9 +1507,9 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t  *surface,
     old_height = surface->height;
     old_paginated_mode = surface->paginated_mode;
     old_clip = _cairo_surface_get_clip (&surface->base);
-    cairo_pdf_surface_set_size_internal (surface,
-					 meta_extents.width,
-					 meta_extents.height);
+    _cairo_pdf_surface_set_size_internal (surface,
+					  meta_extents.width,
+					  meta_extents.height);
     /* Patterns are emitted after fallback images. The paginated mode
      * needs to be set to _RENDER while the meta surface is replayed
      * back to this surface.
@@ -1542,9 +1542,9 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t  *surface,
     status = _cairo_pdf_surface_close_content_stream (surface);
 
  CLEANUP_GROUP:
-    cairo_pdf_surface_set_size_internal (surface,
-					 old_width,
-					 old_height);
+    _cairo_pdf_surface_set_size_internal (surface,
+					  old_width,
+					  old_height);
     surface->paginated_mode = old_paginated_mode;
     status2 = _cairo_surface_set_clip (&surface->base, old_clip);
     if (status == CAIRO_STATUS_SUCCESS)
@@ -2519,9 +2519,9 @@ _cairo_pdf_surface_emit_pattern (cairo_pdf_surface_t *surface, cairo_pdf_pattern
 
     old_width = surface->width;
     old_height = surface->height;
-    cairo_pdf_surface_set_size_internal (surface,
-					 pdf_pattern->width,
-					 pdf_pattern->height);
+    _cairo_pdf_surface_set_size_internal (surface,
+					  pdf_pattern->width,
+					  pdf_pattern->height);
 
     switch (pdf_pattern->pattern->type) {
     case CAIRO_PATTERN_TYPE_SOLID:
@@ -2547,9 +2547,9 @@ _cairo_pdf_surface_emit_pattern (cairo_pdf_surface_t *surface, cairo_pdf_pattern
 	break;
     }
 
-    cairo_pdf_surface_set_size_internal (surface,
-					 old_width,
-					 old_height);
+    _cairo_pdf_surface_set_size_internal (surface,
+					  old_width,
+					  old_height);
 
     return status;
 }
@@ -3831,9 +3831,9 @@ _cairo_pdf_surface_write_smask_group (cairo_pdf_surface_t     *surface,
 
     old_width = surface->width;
     old_height = surface->height;
-    cairo_pdf_surface_set_size_internal (surface,
-					 group->width,
-					 group->height);
+    _cairo_pdf_surface_set_size_internal (surface,
+					  group->width,
+					  group->height);
     /* _mask is a special case that requires two groups - source
      * and mask as well as a smask and gstate dictionary */
     if (group->operation == PDF_MASK)
@@ -3884,9 +3884,9 @@ _cairo_pdf_surface_write_smask_group (cairo_pdf_surface_t     *surface,
     _cairo_pdf_surface_unselect_pattern (surface);
     status = _cairo_pdf_surface_close_group (surface, NULL);
 
-    cairo_pdf_surface_set_size_internal (surface,
-					 old_width,
-					 old_height);
+    _cairo_pdf_surface_set_size_internal (surface,
+					  old_width,
+					  old_height);
 
     return status;
 }


More information about the cairo-commit mailing list