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

Adrian Johnson ajohnson at kemper.freedesktop.org
Sun Mar 9 05:23:33 PDT 2008


 src/cairo-paginated-surface.c |    4 ++--
 src/cairo-ps-surface.c        |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 00091d50a6187acd0fd35aef16a4fa5fab3c8aa9
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Mar 9 16:44:18 2008 +1030

    Add fallback image comment to PS output
    
    To help better understand when fallback images are used, a comment
    similiar to the following is included with each fallback image in the
    PS output.
    
    % Fallback Image: x=101, y=478, w=50, h=10 res=300dpi size=31500

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index dde2aeb..6ab1c0a 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -2230,6 +2230,20 @@ _cairo_ps_surface_paint_surface (cairo_ps_surface_t      *surface,
 	return status;
 
     cairo_p2d = pattern->base.matrix;
+
+    if (surface->paginated_mode == CAIRO_PAGINATED_MODE_FALLBACK) {
+	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",
+				     -cairo_p2d.x0/scale,
+				     -cairo_p2d.y0/scale,
+				     (int)(width/scale),
+				     (int)(height/scale),
+				     scale*72,
+				     (long)width*height*3);
+    }
+
     status = cairo_matrix_invert (&cairo_p2d);
     /* cairo_pattern_set_matrix ensures the matrix is invertible */
     assert (status == CAIRO_STATUS_SUCCESS);
commit 95acec69d8ee4fd37937f5b466c2baf612e9113a
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Mar 9 16:40:25 2008 +1030

    Round fallback image size up instead of down
    
    to ensure the fallback image completely covers the fallback region.

diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index f401aef..e490b45 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -258,8 +258,8 @@ _paint_fallback_image (cairo_paginated_surface_t *surface,
     width = box->p2.x - x;
     height = box->p2.y - y;
     image = _cairo_paginated_surface_create_image_surface (surface,
-							   width  * x_scale,
-							   height * y_scale);
+							   ceil (width  * x_scale),
+							   ceil (height * y_scale));
     _cairo_surface_set_device_scale (image, x_scale, y_scale);
     /* set_device_offset just sets the x0/y0 components of the matrix;
      * so we have to do the scaling manually. */


More information about the cairo-commit mailing list