From aa669c2e1527230762c30c05467841f83bca194d Mon Sep 17 00:00:00 2001 From: Michael Vrhel Date: Fri, 3 Jan 2020 14:35:51 -0800 Subject: When knockout group pushed in strokefill allow alpha=0 When alpha of the fill and the stroke dont match we push a knockout group. We need to draw the stroke or the fill even if its alpha is zero. Bug 692242 --- base/gdevp14.c | 60 +++++++++++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/base/gdevp14.c b/base/gdevp14.c index 17c540046..3f8670543 100644 --- a/base/gdevp14.c +++ b/base/gdevp14.c @@ -3347,7 +3347,7 @@ pdf14_fill_stroke_path(gx_device *dev, const gs_gstate *pgs, gx_path *ppath, } else { /* Push a non-isolated knockout group. Do not change the alpha or - blend modes */ + blend modes. Note: we need to draw those that have alpha = 0 */ params.Isolated = false; params.group_color = UNKNOWN; params.Knockout = true; @@ -3370,38 +3370,34 @@ pdf14_fill_stroke_path(gx_device *dev, const gs_gstate *pgs, gx_path *ppath, if (code < 0) goto cleanup; - if (pgs->fillconstantalpha > 0.0) { - code = gs_setopacityalpha((gs_gstate*) pgs, pgs->fillconstantalpha); - if (code < 0) - goto cleanup; - ((pdf14_device*)dev)->op_state = PDF14_OP_STATE_FILL; - - /* If we are in an overprint situation, set the blend mode to compatible - overprint */ - if (pgs->overprint) - code = gs_setblendmode((gs_gstate*) pgs, BLEND_MODE_CompatibleOverprint); - code = pdf14_fill_path(dev, pgs, ppath, fill_params, pdcolor_fill, pcpath); - if (pgs->overprint) - code = gs_setblendmode((gs_gstate*) pgs, blend_mode); - if (code < 0) - goto cleanup; - } + code = gs_setopacityalpha((gs_gstate*) pgs, pgs->fillconstantalpha); + if (code < 0) + goto cleanup; + ((pdf14_device*)dev)->op_state = PDF14_OP_STATE_FILL; + + /* If we are in an overprint situation, set the blend mode to compatible + overprint */ + if (pgs->overprint) + code = gs_setblendmode((gs_gstate*) pgs, BLEND_MODE_CompatibleOverprint); + code = pdf14_fill_path(dev, pgs, ppath, fill_params, pdcolor_fill, pcpath); + if (pgs->overprint) + code = gs_setblendmode((gs_gstate*) pgs, blend_mode); + if (code < 0) + goto cleanup; - if (pgs->strokeconstantalpha > 0.0) { - code = gs_setopacityalpha((gs_gstate*) pgs, pgs->strokeconstantalpha); - if (code < 0) - goto cleanup; - gs_swapcolors_quick((gs_gstate*) pgs); - ((pdf14_device*)dev)->op_state = PDF14_OP_STATE_STROKE; - if (pgs->stroke_overprint) - code = gs_setblendmode((gs_gstate*) pgs, BLEND_MODE_CompatibleOverprint); - code = pdf14_stroke_path(dev, pgs, ppath, stroke_params, pdcolor_stroke, pcpath); - if (pgs->stroke_overprint) - code = gs_setblendmode((gs_gstate*) pgs, blend_mode); - gs_swapcolors_quick((gs_gstate*) pgs); - if (code < 0) - goto cleanup; /* bail out (with colors swapped back to fill) */ - } + code = gs_setopacityalpha((gs_gstate*) pgs, pgs->strokeconstantalpha); + if (code < 0) + goto cleanup; + gs_swapcolors_quick((gs_gstate*) pgs); + ((pdf14_device*)dev)->op_state = PDF14_OP_STATE_STROKE; + if (pgs->stroke_overprint) + code = gs_setblendmode((gs_gstate*) pgs, BLEND_MODE_CompatibleOverprint); + code = pdf14_stroke_path(dev, pgs, ppath, stroke_params, pdcolor_stroke, pcpath); + if (pgs->stroke_overprint) + code = gs_setblendmode((gs_gstate*) pgs, blend_mode); + gs_swapcolors_quick((gs_gstate*) pgs); + if (code < 0) + goto cleanup; /* bail out (with colors swapped back to fill) */ } /* Now during the pop do the compositing with alpha of 1.0 and normal blend */ -- cgit v1.2.1