From 934c511da4d3585631b4a32a81a16228202f9ec7 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 9 May 2018 15:13:46 +0200 Subject: Fix 699319: Apply clip path after drawing, not before. --- source/pdf/pdf-op-run.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c index 080452a8..8ef1943a 100644 --- a/source/pdf/pdf-op-run.c +++ b/source/pdf/pdf-op-run.c @@ -633,13 +633,6 @@ pdf_show_path(fz_context *ctx, pdf_run_processor *pr, int doclose, int dofill, i fz_bound_path(ctx, path, (dostroke ? gstate->stroke_state : NULL), &gstate->ctm, &bbox); - if (pr->clip) - { - gstate->clip_depth++; - fz_clip_path(ctx, pr->dev, path, pr->clip_even_odd, &gstate->ctm, &bbox); - pr->clip = 0; - } - if (pr->super.hidden) dostroke = dofill = 0; @@ -728,6 +721,14 @@ pdf_show_path(fz_context *ctx, pdf_run_processor *pr, int doclose, int dofill, i if (dofill || dostroke) pdf_end_group(ctx, pr, &softmask); + + if (pr->clip) + { + gstate = pr->gstate + pr->gtop; /* in case it was changed by pdf_begin_group */ + gstate->clip_depth++; + fz_clip_path(ctx, pr->dev, path, pr->clip_even_odd, &gstate->ctm, &bbox); + pr->clip = 0; + } } fz_always(ctx) { -- cgit v1.2.3