[cairo-commit] 2 commits - src/cairo-ps-surface.c

Adrian Johnson ajohnson at kemper.freedesktop.org
Sat Sep 10 08:15:26 PDT 2011


 src/cairo-ps-surface.c |   31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

New commits:
commit 0540bf384aed344899417d3b0313bd6704679c1c
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Sep 10 23:39:15 2011 +0930

    ps: improve formatting of fallback image comment

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index cf1c8d8..a804887 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -3029,7 +3029,7 @@ _cairo_ps_surface_paint_surface (cairo_ps_surface_t      *surface,
 	double scale = cairo_p2d.xx;
 
 	_cairo_output_stream_printf (surface->stream,
-				     "%% Fallback Image: x=%f, y=%f, w=%d, h=%d res=%fdpi size=%ld\n",
+				     "%% Fallback Image: x=%f y=%f w=%d h=%d res=%fppi size=%ld\n",
 				     -cairo_p2d.x0/scale,
 				     -cairo_p2d.y0/scale,
 				     (int)(width/scale),
commit 2d887d99c74f2097021a1f4f7c1d2306b8f9b429
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Sep 10 23:21:28 2011 +0930

    ps: use reusable stream for mesh pattern data
    
    File data used by a shading pattern must reusable since the pattern
    may read the file multiple times. As currentfile is not reusable, use
    the /ReusableStreamDecode to make it reusable.

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index fcfb2f1..cf1c8d8 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -3605,11 +3605,25 @@ _cairo_ps_surface_emit_mesh_pattern (cairo_ps_surface_t     *surface,
 	return status;
 
     _cairo_output_stream_printf (surface->stream,
+				 "currentfile\n"
+				 "/ASCII85Decode filter /FlateDecode filter /ReusableStreamDecode filter\n");
+
+    status = _cairo_ps_surface_emit_base85_string (surface,
+						   shading.data,
+						   shading.data_length,
+						   CAIRO_PS_COMPRESS_DEFLATE,
+						   FALSE);
+    if (status)
+	return status;
+
+    _cairo_output_stream_printf (surface->stream,
+				 "\n"
+				 "/CairoData exch def\n"
 				 "<< /PatternType 2\n"
 				 "   /Shading\n"
 				 "   << /ShadingType %d\n"
 				 "      /ColorSpace /DeviceRGB\n"
-				 "      /DataSource currentfile /ASCII85Decode filter /FlateDecode filter\n"
+				 "      /DataSource CairoData\n"
 				 "      /BitsPerCoordinate %d\n"
 				 "      /BitsPerComponent %d\n"
 				 "      /BitsPerFlag %d\n"
@@ -3633,16 +3647,9 @@ _cairo_ps_surface_emit_mesh_pattern (cairo_ps_surface_t     *surface,
                                  pat_to_ps.xy, pat_to_ps.yy,
                                  pat_to_ps.x0, pat_to_ps.y0);
     _cairo_output_stream_printf (surface->stream,
-				 "makepattern\n");
-
-    status = _cairo_ps_surface_emit_base85_string (surface,
-						   shading.data,
-						   shading.data_length,
-						   CAIRO_PS_COMPRESS_DEFLATE,
-						   FALSE);
-    _cairo_output_stream_printf (surface->stream,
-				 "\n"
-				 "setpattern\n");
+				 "makepattern\n"
+				 "setpattern\n"
+				 "currentdict /CairoData undef\n");
 
     _cairo_pdf_shading_fini (&shading);
 


More information about the cairo-commit mailing list