Fix for 687820 /nocurrentpoint in --.pathbbox--
Raph Levien <[email protected]> Mon, 29 Nov 2004 13:20:09 -0800
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
Reviewers,
The test file has a "n W n" sequence, which is a request to clip to
a totally empty path. The error comes from code added to pdf_ops.ps v
1.33 to handle the case where a path is defined but has an empty
bbox. See bug 687136 for more details on this change. Comment #8 of
that bug report suggests that our PDF interpreter always maintains a
currentpoint, which would justify the use of an unprotected
pathbbox. However, that assumption seems to be false.
The proposed fix is quite straightforward: just enclose the pathbbox
operators in a stopped context, and treat empty paths the same as paths
with empty bboxes (i.e. n W n acts as a no-op).
Raph
Index: lib/pdf_ops.ps
===================================================================
RCS file: /cvs/ghostscript/gs/lib/pdf_ops.ps,v
retrieving revision 1.36
diff -C2 -r1.36 pdf_ops.ps
*** lib/pdf_ops.ps 20 Sep 2004 23:28:24 -0000 1.36
--- lib/pdf_ops.ps 29 Nov 2004 21:19:13 -0000
***************
*** 379,383 ****
/f* { gsave setfillstate eofill grestore n } bdef
% Adobe PDF Rendering doesn't change clipping if path is 0 area
! /n { end pathbbox 3 -1 roll sub abs 3 1 roll sub abs add 0 ne { clip } if newpath } bdef
end readonly def
/W { //Wdict begin } bdef
--- 379,384 ----
/f* { gsave setfillstate eofill grestore n } bdef
% Adobe PDF Rendering doesn't change clipping if path is 0 area
! /n { end { pathbbox 3 -1 roll sub abs 3 1 roll sub abs add
! } stopped { 0 } if 0 ne { clip } if newpath } bdef
end readonly def
/W { //Wdict begin } bdef
***************
*** 385,389 ****
Wdict { def } forall
% Adobe PDF Rendering doesn't change clipping if path is 0 area
! /n { end pathbbox 3 -1 roll sub abs 3 1 roll sub abs add 0 ne { eoclip } if newpath } bdef
end readonly def
/W* { //W*dict begin } bdef
--- 386,391 ----
Wdict { def } forall
% Adobe PDF Rendering doesn't change clipping if path is 0 area
! /n { end { pathbbox 3 -1 roll sub abs 3 1 roll sub abs add
! } stopped { 0 } if 0 ne { eoclip } if newpath } bdef
end readonly def
/W* { //W*dict begin } bdef