[cairo-commit] 7 commits - src/cairoint.h src/cairo-pdf-surface.c src/cairo-ps-surface.c src/cairo-surface.c test/clip-operator-pdf-rgb24-ref.png test/clip-operator-ps-rgb24-ref.png test/operator-source-pdf-argb32-ref.png test/operator-source-pdf-rgb24-ref.png test/operator-source-ps-argb32-ref.png test/operator-source-ps-rgb24-ref.png test/stroke-image-pdf-ref.png test/stroke-image-ps-ref.png

Adrian Johnson ajohnson at kemper.freedesktop.org
Sat Mar 29 06:53:28 PDT 2008


 src/cairo-pdf-surface.c                 |   18 +++++++++--
 src/cairo-ps-surface.c                  |   49 +++++++++++++++++++++-----------
 src/cairo-surface.c                     |    6 +++
 src/cairoint.h                          |    3 +
 test/clip-operator-pdf-rgb24-ref.png    |binary
 test/clip-operator-ps-rgb24-ref.png     |binary
 test/operator-source-pdf-argb32-ref.png |binary
 test/operator-source-pdf-rgb24-ref.png  |binary
 test/operator-source-ps-argb32-ref.png  |binary
 test/operator-source-ps-rgb24-ref.png   |binary
 test/stroke-image-pdf-ref.png           |binary
 test/stroke-image-ps-ref.png            |binary
 12 files changed, 57 insertions(+), 19 deletions(-)

New commits:
commit a30ed53a1ce37f68f2ee8abf0f631bcc180e0e57
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Mar 30 00:13:35 2008 +1030

    Add stroke-image PS/PDF ref images

diff --git a/test/stroke-image-pdf-ref.png b/test/stroke-image-pdf-ref.png
new file mode 100644
index 0000000..f3eb75d
Binary files /dev/null and b/test/stroke-image-pdf-ref.png differ
diff --git a/test/stroke-image-ps-ref.png b/test/stroke-image-ps-ref.png
new file mode 100644
index 0000000..f557c75
Binary files /dev/null and b/test/stroke-image-ps-ref.png differ
commit a729f27f3c5770277d691257d2355ffb97e3172f
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Mar 30 00:07:05 2008 +1030

    Add clip-operator PS/PDF rgb24 ref images

diff --git a/test/clip-operator-pdf-rgb24-ref.png b/test/clip-operator-pdf-rgb24-ref.png
new file mode 100644
index 0000000..f9377fa
Binary files /dev/null and b/test/clip-operator-pdf-rgb24-ref.png differ
diff --git a/test/clip-operator-ps-rgb24-ref.png b/test/clip-operator-ps-rgb24-ref.png
new file mode 100644
index 0000000..1736e4b
Binary files /dev/null and b/test/clip-operator-ps-rgb24-ref.png differ
commit 9058b9260acce8839263fccf451a982bcb1c54f3
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Mar 29 23:49:51 2008 +1030

    Add operator-source PDF ref images
    
    Required due to gradient rendering differences between poppler and
    cairo.

diff --git a/test/operator-source-pdf-argb32-ref.png b/test/operator-source-pdf-argb32-ref.png
new file mode 100644
index 0000000..821112a
Binary files /dev/null and b/test/operator-source-pdf-argb32-ref.png differ
diff --git a/test/operator-source-pdf-rgb24-ref.png b/test/operator-source-pdf-rgb24-ref.png
new file mode 100644
index 0000000..6faf143
Binary files /dev/null and b/test/operator-source-pdf-rgb24-ref.png differ
commit 47981226db1650799ddb5efba01df2564aa1a3b5
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Mar 29 23:45:31 2008 +1030

    Fix PDF analysis of OPERATOR_SOURCE surface patterns

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 7b4a83c..7a52951 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -4154,9 +4154,10 @@ _cairo_pdf_surface_analyze_operation (cairo_pdf_surface_t  *surface,
     if (! _pattern_supported (pattern))
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
-    if (op == CAIRO_OPERATOR_OVER || op == CAIRO_OPERATOR_SOURCE) {
+    if (op == CAIRO_OPERATOR_OVER) {
 	if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
 	    cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern;
+
 	    if ( _cairo_surface_is_meta (surface_pattern->surface))
 		return CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN;
 	}
@@ -4171,8 +4172,13 @@ _cairo_pdf_surface_analyze_operation (cairo_pdf_surface_t  *surface,
 	if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
 	    cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern;
 
-	    return _cairo_pdf_surface_analyze_surface_pattern_transparency (surface,
-									    surface_pattern);
+	    if (_cairo_surface_is_meta (surface_pattern->surface)) {
+		if (_cairo_pattern_is_opaque (pattern))
+		    return CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN;
+	    } else {
+		return _cairo_pdf_surface_analyze_surface_pattern_transparency (surface,
+										surface_pattern);
+	    }
 	}
 
 	if (_cairo_pattern_is_opaque (pattern))
commit 53d1a4b0dcb3a1fa62face9d2b5b086d74b6e397
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Mar 29 23:03:02 2008 +1030

    Update operator-source PS ref images

diff --git a/test/operator-source-ps-argb32-ref.png b/test/operator-source-ps-argb32-ref.png
index acb1e37..d5cb053 100644
Binary files a/test/operator-source-ps-argb32-ref.png and b/test/operator-source-ps-argb32-ref.png differ
diff --git a/test/operator-source-ps-rgb24-ref.png b/test/operator-source-ps-rgb24-ref.png
index f330491..eb73a9e 100644
Binary files a/test/operator-source-ps-rgb24-ref.png and b/test/operator-source-ps-rgb24-ref.png differ
commit b3b3e3810d6ea9e75d5accd8e0d2ad00f664b4a5
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Mar 29 19:14:18 2008 +1030

    PS: Clear pattern background to when using OPERATOR_SOURCE
    
    Set pattern background to white if surface content is COLOR_ALPHA or
    black if surface content is COLOR when operator is SOURCE.

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index cdef863..e906563 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -2213,6 +2213,14 @@ _cairo_ps_surface_paint_surface (cairo_ps_surface_t      *surface,
 				     (int)(height/scale),
 				     scale*72,
 				     (long)width*height*3);
+    } else {
+	if (op == CAIRO_OPERATOR_SOURCE) {
+	    _cairo_output_stream_printf (surface->stream,
+					 "%d g 0 0 %f %f rectfill\n",
+					 surface->content == CAIRO_CONTENT_COLOR ? 0 : 1,
+					 surface->width,
+					 surface->height);
+	}
     }
 
     status = cairo_matrix_invert (&cairo_p2d);
@@ -2319,6 +2327,12 @@ _cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t      *surface,
 
     old_use_string_datasource = surface->use_string_datasource;
     surface->use_string_datasource = TRUE;
+    if (op == CAIRO_OPERATOR_SOURCE) {
+	_cairo_output_stream_printf (surface->stream,
+				     "%d g 0 0 %f %f rectfill\n",
+				     surface->content == CAIRO_CONTENT_COLOR ? 0 : 1,
+				     xstep, ystep);
+    }
     status = _cairo_ps_surface_emit_surface (surface, pattern, op);
     if (status)
 	return status;
@@ -2350,10 +2364,17 @@ _cairo_ps_surface_emit_surface_pattern (cairo_ps_surface_t      *surface,
 				     pattern_height*2,
 				     pattern_width*2);
     } else {
+	if (op == CAIRO_OPERATOR_SOURCE) {
+	    _cairo_output_stream_printf (surface->stream,
+					 "   /BBox [0 0 %f %f]\n",
+					 xstep, ystep);
+	} else {
+	    _cairo_output_stream_printf (surface->stream,
+					 "   /BBox [0 0 %d %d]\n",
+					 pattern_width, pattern_height);
+	}
 	_cairo_output_stream_printf (surface->stream,
-				     "   /BBox [0 0 %d %d]\n"
-				     "   /PaintProc { CairoPattern }\n",
-				     pattern_width, pattern_height);
+				     "   /PaintProc { CairoPattern }\n");
     }
 
     _cairo_output_stream_printf (surface->stream,
@@ -2881,23 +2902,15 @@ _cairo_ps_surface_paint (void			*abstract_surface,
 				 "%% _cairo_ps_surface_paint\n");
 #endif
 
-    status = _cairo_surface_get_extents (&surface->base, &surface_extents);
+    status = _cairo_surface_get_extents (&surface->base, &extents);
     if (status)
 	return status;
 
-    status = _cairo_pattern_get_extents (source, &extents);
-    if (status)
-	return status;
-
-    _cairo_rectangle_intersect (&extents, &surface_extents);
-
     if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
 	(source->extend == CAIRO_EXTEND_NONE ||
 	 source->extend == CAIRO_EXTEND_PAD))
     {
-	_cairo_output_stream_printf (stream, "q %d %d %d %d rectclip\n",
-				     extents.x,
-				     surface_extents.height - extents.y - extents.height,
+	_cairo_output_stream_printf (stream, "q 0 0 %d %d rectclip\n",
 				     extents.width,
 				     extents.height);
 
@@ -2916,9 +2929,7 @@ _cairo_ps_surface_paint (void			*abstract_surface,
 	if (status)
 	    return status;
 
-	_cairo_output_stream_printf (stream, "%d %d %d %d rectfill\n",
-				     extents.x,
-				     surface_extents.height - extents.y - extents.height,
+	_cairo_output_stream_printf (stream, "0 0 %d %d rectfill\n",
 				     extents.width,
 				     extents.height);
     }
commit 5b8b3a9765d292d554b50df0981652d3bb4ec56f
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Mar 29 01:07:30 2008 +1030

    PS/PDF: Save/Restore surface clip when emitting a meta-surface pattern

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 7dad2f5..7b4a83c 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -1494,6 +1494,7 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t  *surface,
     double old_width, old_height;
     cairo_matrix_t old_cairo_to_pdf;
     cairo_paginated_mode_t old_paginated_mode;
+    cairo_clip_t *old_clip;
     cairo_rectangle_int_t meta_extents;
     cairo_status_t status;
     int alpha = 0;
@@ -1506,6 +1507,7 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t  *surface,
     old_height = surface->height;
     old_cairo_to_pdf = surface->cairo_to_pdf;
     old_paginated_mode = surface->paginated_mode;
+    old_clip = _cairo_surface_get_clip (&surface->base);
     surface->width = meta_extents.width;
     surface->height = meta_extents.height;
     /* Patterns are emitted after fallback images. The paginated mode
@@ -1548,6 +1550,10 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t  *surface,
     surface->height = old_height;
     surface->paginated_mode = old_paginated_mode;
     surface->cairo_to_pdf = old_cairo_to_pdf;
+    status = _cairo_surface_set_clip (&surface->base, old_clip);
+    if (status)
+	return status;
+
     _cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
 						  &surface->cairo_to_pdf);
 
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index b771048..cdef863 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -2030,6 +2030,7 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t  *surface,
     double old_width, old_height;
     cairo_matrix_t old_cairo_to_ps;
     cairo_content_t old_content;
+    cairo_clip_t *old_clip;
     cairo_rectangle_int_t meta_extents;
     cairo_status_t status;
 
@@ -2041,6 +2042,7 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t  *surface,
     old_width = surface->width;
     old_height = surface->height;
     old_cairo_to_ps = surface->cairo_to_ps;
+    old_clip = _cairo_surface_get_clip (&surface->base);
     surface->width = meta_extents.width;
     surface->height = meta_extents.height;
     cairo_matrix_init (&surface->cairo_to_ps, 1, 0, 0, -1, 0, surface->height);
@@ -2072,6 +2074,10 @@ _cairo_ps_surface_emit_meta_surface (cairo_ps_surface_t  *surface,
     surface->width = old_width;
     surface->height = old_height;
     surface->cairo_to_ps = old_cairo_to_ps;
+    status = _cairo_surface_set_clip (&surface->base, old_clip);
+    if (status)
+	return status;
+
     _cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators,
 						  &surface->cairo_to_ps);
 
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 23e79d2..a724283 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1985,6 +1985,12 @@ _cairo_surface_set_empty_clip_path (cairo_surface_t *surface,
     return _cairo_surface_set_error (surface, status);
 }
 
+cairo_clip_t *
+_cairo_surface_get_clip (cairo_surface_t *surface)
+{
+    return surface->clip;
+}
+
 cairo_status_t
 _cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip)
 {
diff --git a/src/cairoint.h b/src/cairoint.h
index 9fa4bde..41d9182 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1750,6 +1750,9 @@ _cairo_surface_intersect_clip_path (cairo_surface_t    *surface,
 				    double		tolerance,
 				    cairo_antialias_t	antialias);
 
+cairo_private cairo_clip_t *
+_cairo_surface_get_clip (cairo_surface_t *surface);
+
 cairo_private cairo_status_t
 _cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip);
 


More information about the cairo-commit mailing list