diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2023-04-26 14:36:37 +0100 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2023-04-26 17:59:48 +0100 |
commit | 02402b4f07b9889df87522bd0dac52c46dcde947 (patch) | |
tree | 588bc1905d1588fe9e243f967bf5f558677c030c | |
parent | 700cb751209a8750100df6173dfecffeb508d057 (diff) | |
download | ghostpdl-02402b4f07b9889df87522bd0dac52c46dcde947.tar.gz |
Bug 706643: Fix fill_stroke transparency handling.
The code to handle fill_stroke in the presence of transparency
was being confused by the scaling applied to clipping regions.
When we fill_stroke, if transparency is present, then we need to
push a group. The bounds for this group are calculated based upon
the bounds for the path in question, expanded by an appropriate
amount for the current stroke strate, and then clipped by the
clipping path.
In the presence of alphabits, the path is scaled up, and so the
bbox for it needs to be scaled down. The clipping path is similarly
scaled, so this too needs to be scaled down.
-rw-r--r-- | base/gdevp14.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/base/gdevp14.c b/base/gdevp14.c index 17c1ee95b..edbee1ce7 100644 --- a/base/gdevp14.c +++ b/base/gdevp14.c @@ -4312,16 +4312,21 @@ pdf14_fill_stroke_prefill(gx_device* dev, gs_gstate* pgs, gx_path* ppath, (pgs->ctm.xx == 0.0 && pgs->ctm.xy == 0.0 && pgs->ctm.yx == 0.0 && pgs->ctm.yy == 0.0)) return 0; + /* The clip box returned here is scaled up by path_log2scale, so we need + * to scale down by this later. */ code = gx_curr_fixed_bbox(pgs, &clip_bbox, NO_PATH); if (code < 0 && code != gs_error_unknownerror) return code; if (code == gs_error_unknownerror) { /* didn't get clip box from gx_curr_fixed_bbox */ + /* This is NOT scaled by path_log2scale, so allow for the fact we'll be + * scaling down by this in a moment. */ clip_bbox.p.x = clip_bbox.p.y = 0; - clip_bbox.q.x = int2fixed(dev->width); - clip_bbox.q.y = int2fixed(dev->height); + clip_bbox.q.x = int2fixed(dev->width) << path_log2scale.x; + clip_bbox.q.y = int2fixed(dev->height) << path_log2scale.y; } + /* pcpath->outer_box is scaled by path_log2scale too. */ if (pcpath) rect_intersect(clip_bbox, pcpath->outer_box); @@ -4336,6 +4341,10 @@ pdf14_fill_stroke_prefill(gx_device* dev, gs_gstate* pgs, gx_path* ppath, path_bbox.q.x = path_bbox.q.x >> path_log2scale.x; path_bbox.p.y = path_bbox.p.y >> path_log2scale.y; path_bbox.q.y = path_bbox.q.y >> path_log2scale.y; + clip_bbox.p.x = clip_bbox.p.x >> path_log2scale.x; + clip_bbox.q.x = clip_bbox.q.x >> path_log2scale.x; + clip_bbox.p.y = clip_bbox.p.y >> path_log2scale.y; + clip_bbox.q.y = clip_bbox.q.y >> path_log2scale.y; } if (code == gs_error_nocurrentpoint && ppath->segments->contents.subpath_first == 0) { |