diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2013-09-29 22:23:31 +0930 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2013-09-29 22:23:31 +0930 |
commit | 5e6e4536716197ea0605732d32959c57ea8bb140 (patch) | |
tree | 618e392cabf4b5a61c5f1a1bc71db1fe51c95af2 | |
parent | d3a8d5a9c266b79b0059dd309b5e3eff3ce81a64 (diff) |
pdf: stencil masks may be opaque
-rw-r--r-- | src/cairo-pdf-surface.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index a5a43bc..a8a1217 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -2301,6 +2301,7 @@ _cairo_pdf_surface_emit_smask (cairo_pdf_surface_t *surface, /* This is the only image format we support, which simplifies things. */ assert (image->format == CAIRO_FORMAT_ARGB32 || + image->format == CAIRO_FORMAT_RGB24 || image->format == CAIRO_FORMAT_A8 || image->format == CAIRO_FORMAT_A1 ); @@ -2309,11 +2310,10 @@ _cairo_pdf_surface_emit_smask (cairo_pdf_surface_t *surface, assert (transparency == CAIRO_IMAGE_IS_OPAQUE || transparency == CAIRO_IMAGE_HAS_BILEVEL_ALPHA); } else { - if (transparency == CAIRO_IMAGE_IS_OPAQUE) - return status; + assert (transparency != CAIRO_IMAGE_IS_OPAQUE); } - if (transparency == CAIRO_IMAGE_HAS_BILEVEL_ALPHA) { + if (transparency == CAIRO_IMAGE_HAS_BILEVEL_ALPHA || transparency == CAIRO_IMAGE_IS_OPAQUE) { alpha_size = (image->width + 7) / 8 * image->height; alpha = _cairo_malloc_ab ((image->width+7) / 8, image->height); } else { @@ -2328,7 +2328,10 @@ _cairo_pdf_surface_emit_smask (cairo_pdf_surface_t *surface, i = 0; for (y = 0; y < image->height; y++) { - if (image->format == CAIRO_FORMAT_A1) { + if (transparency == CAIRO_IMAGE_IS_OPAQUE) { + for (x = 0; x < (image->width + 7) / 8; x++) + alpha[i++] = 0xff; + } else if (image->format == CAIRO_FORMAT_A1) { pixel8 = (uint8_t *) (image->data + y * image->stride); for (x = 0; x < (image->width + 7) / 8; x++, pixel8++) { |