From 1bff2db7620df6efc889c1f6dbaa42a7df6ef9cd Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Fri, 23 Mar 2012 21:49:42 +1030 Subject: [PATCH] cairo: use a transparency group with setSoftMaskFromImageMask/unsetSoftMaskFromImageMask Drawing a tiling pattern between setSoftMaskFromImageMask and unsetSoftMaskFromImageMask clears the softmask. Similar to Splash, create a transparency group in setSoftMaskFromImageMask. Pop and paint the group in unsetSoftMaskFromImageMask. The saveState/restoreState is to ensure the softmask is restored before painting the group. Bug 47739 --- poppler/CairoOutputDev.cc | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 6652a35..66248e2 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -1859,12 +1859,28 @@ void CairoOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stre 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 (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(), + gTrue, gFalse, gFalse); } void CairoOutputDev::unsetSoftMaskFromImageMask(GfxState *state) { + double bbox[4] = {0,0,1,1}; // dummy + + endTransparencyGroup(state); + restoreState(state); + paintTransparencyGroup(state, bbox); clearSoftMask(state); } -- 1.7.5.4