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

Vladimir Vukicevic vladimir at kemper.freedesktop.org
Fri Jan 25 15:05:55 PST 2008


 src/cairo-ps-surface.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit c621d8d7191bfa8c1bca533bf9d53d514d01f529
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Fri Jan 25 15:01:44 2008 -0800

    [ps] Pad image mask lines out to full lines
    
    The PostScript backend was generating image masks with packed mask
    bits, when PS seems to expect each line of the mask to be padded out
    to 8 bytes.
    
    Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=407360

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 5d6b3e6..d54b22b 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1,3 +1,4 @@
+/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */
 /* cairo - a vector graphics library with display and print output
  *
  * Copyright © 2003 University of Southern California
@@ -2101,7 +2102,7 @@ _cairo_ps_surface_emit_image (cairo_ps_surface_t    *surface,
     }
 
     if (use_mask) {
-	mask_size = (image->width * image->height + 7)/8;
+	mask_size = ((image->width+7) / 8) * image->height;
 	mask = malloc (mask_size);
 	if (mask == NULL) {
 	    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
@@ -2129,6 +2130,11 @@ _cairo_ps_surface_emit_image (cairo_ps_surface_t    *surface,
 		rgb[i++] = (*pixel & 0x0000ff00) >>  8;
 		rgb[i++] = (*pixel & 0x000000ff) >>  0;
 	    }
+
+	    if (bit != 7) {
+		bit = 7;
+		byte++;
+	    }
 	}
     } else {
 	i = 0;


More information about the cairo-commit mailing list