summaryrefslogtreecommitdiff
authorCarlos Garcia Campos <carlosgc@gnome.org>2014-07-24 08:46:17 (GMT)
committer Carlos Garcia Campos <carlosgc@gnome.org>2014-07-24 10:03:31 (GMT)
commit02c127b355bb8a98684a5d0af063c60b8bfd09dd (patch) (side-by-side diff)
tree8be1b439bfcd7e67e2c0523cee6125b7b99783dd
parentc841a703c4c1750fd7ac0d04c6c3e7d4af80b8fa (diff)
downloadpoppler-master.zip
poppler-master.tar.gz
cairo: Make sure we always push a transparency group in setSoftMaskFromImageMask()HEADmaster
Because that's what unsetSoftMaskFromImageMask() assumes. https://bugs.freedesktop.org/show_bug.cgi?id=81624
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--poppler/CairoOutputDev.cc64
1 files changed, 31 insertions, 33 deletions
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index f31b46b..c2827c6 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1880,46 +1880,44 @@ void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stre
delete imgStr;
invert_bit = invert ? 1 : 0;
- if (pix ^ invert_bit)
- return;
-
- cairo_save (cairo);
- cairo_rectangle (cairo, 0., 0., width, height);
- cairo_fill (cairo);
- cairo_restore (cairo);
- if (cairo_shape) {
- cairo_save (cairo_shape);
- cairo_rectangle (cairo_shape, 0., 0., width, height);
- cairo_fill (cairo_shape);
- cairo_restore (cairo_shape);
+ if (!(pix ^ invert_bit)) {
+ cairo_save (cairo);
+ cairo_rectangle (cairo, 0., 0., width, height);
+ cairo_fill (cairo);
+ cairo_restore (cairo);
+ if (cairo_shape) {
+ cairo_save (cairo_shape);
+ cairo_rectangle (cairo_shape, 0., 0., width, height);
+ cairo_fill (cairo_shape);
+ cairo_restore (cairo_shape);
+ }
}
- return;
- }
+ } else {
+ cairo_push_group_with_content (cairo, CAIRO_CONTENT_ALPHA);
- cairo_push_group_with_content (cairo, CAIRO_CONTENT_ALPHA);
+ /* shape is 1.0 for painted areas, 0.0 for unpainted ones */
- /* shape is 1.0 for painted areas, 0.0 for unpainted ones */
+ cairo_matrix_t matrix;
+ cairo_get_matrix (cairo, &matrix);
+ //XXX: it is possible that we should only do sub pixel positioning if
+ // we are rendering fonts */
+ if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) {
+ drawImageMaskPrescaled(state, ref, str, width, height, invert, gFalse, inlineImg);
+ } else {
+ drawImageMaskRegular(state, ref, str, width, height, invert, gFalse, inlineImg);
+ }
- cairo_matrix_t matrix;
- cairo_get_matrix (cairo, &matrix);
- //XXX: it is possible that we should only do sub pixel positioning if
- // we are rendering fonts */
- if (!printing && prescaleImages && matrix.xy == 0.0 && matrix.yx == 0.0) {
- drawImageMaskPrescaled(state, ref, str, width, height, invert, gFalse, inlineImg);
- } else {
- drawImageMaskRegular(state, ref, str, width, height, invert, gFalse, inlineImg);
- }
+ if (state->getFillColorSpace()->getMode() == csPattern) {
+ cairo_set_source_rgb (cairo, 1, 1, 1);
+ cairo_set_matrix (cairo, &mask_matrix);
+ cairo_mask (cairo, mask);
+ }
- if (state->getFillColorSpace()->getMode() == csPattern) {
- cairo_set_source_rgb (cairo, 1, 1, 1);
- cairo_set_matrix (cairo, &mask_matrix);
- cairo_mask (cairo, mask);
+ if (mask)
+ cairo_pattern_destroy (mask);
+ mask = cairo_pop_group (cairo);
}
- if (mask)
- cairo_pattern_destroy (mask);
- mask = cairo_pop_group (cairo);
-
saveState(state);
double bbox[4] = {0,0,1,1}; // dummy
beginTransparencyGroup(state, bbox, state->getFillColorSpace(),