diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2017-08-29 10:37:23 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2017-08-29 10:37:23 +0100 |
commit | ed962af64e86887b0c2ca614c877bb743315d414 (patch) | |
tree | 1172a0398f9f53822997835272d582c11c9253b9 | |
parent | 93b7c164f969787767da98ea3cb4b3efdb6ffc32 (diff) | |
download | ghostpdl-ed962af64e86887b0c2ca614c877bb743315d414.tar.gz |
PDF Interpreter - Paint one pixel for Patterns with BBox width/height of 0
Bug #698431 "PDF 2.0 - Patterns with BBox where width or height = 0 should paint 1 pixel"
The ISO32000-2:2017 specification explicitly states (See section 8.7.3.1
Table 74 and section 8.7.4.3 Table 77) that a Pattern with a BBox where
the width or height is 0 should still paint one pixel.
We achieve this here by detecting the condition where width or height in
a Pattern BBox is exactly 0, and add a tiny amount to the urx or ury
to ensure that one pixels is touched, and therefore painted.
-rw-r--r-- | Resource/Init/pdf_draw.ps | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Resource/Init/pdf_draw.ps b/Resource/Init/pdf_draw.ps index de96f77dc..d067b0500 100644 --- a/Resource/Init/pdf_draw.ps +++ b/Resource/Init/pdf_draw.ps @@ -128,6 +128,20 @@ pdfdict begin 1 index /Default eq { exch pop } { pop resolveidfnproc } ifelse } bdef +%% A BBox where width or height (or both) is 0 should still paint one pixel +%% See the ISO 32000-2:2017 spec, section 8.7.4.3, p228 'BBox' and 8.7.3.1 +/FixPatternBBox +{ + dup aload pop + 3 index 2 index sub 0 eq { + 3 index 0.000001 add 3 -1 roll pop exch + } if + 2 index 1 index sub 0 eq { + 2 index 0.000001 add exch pop + }if + 5 -1 roll astore +}bind def + % ---------------- Shadings ---------------- % /shrdict mark @@ -149,6 +163,7 @@ pdfdict begin /BBox { dup dup dup aload pop normrect_elems 5 -1 roll astore + FixPatternBBox } bind /ColorSpace { resolvecolorspace @@ -1183,7 +1198,7 @@ currentdict end readonly def 2 index /Resources knownoget { oforce } { 0 dict } ifelse /.pdfpaintproc cvx ] cvx put - dup /BBox 2 copy knownoget { normrect put } { pop pop } ifelse + dup /BBox 2 copy knownoget { normrect FixPatternBBox put } { pop pop } ifelse dup /.pattern_uses_transparency 1 index patternusestransparency put PDFDEBUG { pdfdict /PDFSTEPcount .knownget { 1 le } { //true } ifelse { (%Pattern: ) print dup === flush } if } if } bdef |