summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2021-03-11 13:09:52 +0000
committerChris Liddell <chris.liddell@artifex.com>2021-03-20 17:30:38 +0000
commit224cafab373865f96f49ac186012bad63b99ff3b (patch)
tree870e1ed0412940f0f3aa9c3d4b71911b9a647808
parente2f1611a14000d6a2927ac49a865e5a954dd88b2 (diff)
downloadghostpdl-224cafab373865f96f49ac186012bad63b99ff3b.tar.gz
Bug 703324 - restore fill state after fill+stroke path operation
The file in bug 703324 fills and strokes a rectangle ('B' operator) and sets the fill constant alpha to 1, and the stroke constant alpha to 0, so that the stroke is not drawn. Pointless but that's what it does. It then draws some text. Now the clist maintains an 'opacity' member, which is set and reset by (amongst other things) looking at the fill and stroke alpha values. When we do a fill+stroke we set the opacity to the fill alpha, and do the fill, then we set it to the stroke alpha and draw the stroke. We then do an 'image_fill_masked' operation to draw the text bitmaps. This device method does not take a graphics state as a parameter and so is unable to set the opacity in the device based on the fill alpha. It simply uses whatever opacity is current at the time. Because the fill+stroke left this at the 'stroke' alpha, this is applied to the text which (because the alpha is 0) is then not drawn. In addition the graphics state fill constant alpha value was left with the wrong value, but fixing that wasn't sufficient. However we should do both, and this commit resets the fill constant alpha in the graphics state and recalculates the 'opacity'.
-rw-r--r--base/gdevp14.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/base/gdevp14.c b/base/gdevp14.c
index 53c072d14..f103bdb77 100644
--- a/base/gdevp14.c
+++ b/base/gdevp14.c
@@ -4372,6 +4372,14 @@ pdf14_fill_stroke_path(gx_device *dev, const gs_gstate *cpgs, gx_path *ppath,
gs_swapcolors_quick(pgs);
if (code < 0)
goto cleanup;
+ /* Bug 703324 we need to reset the fill constant alpha in the graphics
+ * state to the correct saved value. We also need to reset the 'opacity' member of the
+ * device, because some device methods (eg fill_masked_image) don't take a graphics
+ * state pointer as a parameter and so are unable to set the opacity value themselves.
+ * We therefore need to make sure it is set according to the current fill state.
+ */
+ (void)gs_setfillconstantalpha(pgs, fill_alpha);
+ pdf14_set_marking_params(dev, pgs);
}
cleanup: