Re: Re: [gs-cvs] gs/lib
Ray Johnston <[email protected]>
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
Igor,
Refer to: http://bugs.ghostscript.com/show_bug.cgi?id=687136
As I wrote in the follow up to the bug when I closed it:
"Since the PDF interpreter always seems to retain a 'currentpoint',
the path may consists of only that point. Detect this by the
case where pathbbox shows a net zero area."
Thus the '{currentpoint pop pop} stopped' method will not work.
I had first implemented this simpler approach, and when it did not
work I had to develop a method that works when the path consists
of only a moveto.
Regards,
Ray
_________________________________________________________________
Igor V. Melichev wrote:
> I don't think that this patch is conforming,
> because 0x0 bbox is not same as an empty path :
>
> 0 0 moveto closepath clip
>
> In this case we must paint nothing rather than ignore the clipping.
> The correct condition is :
>
> { currentpoint pop pop } stopped
>
> Igor.
>
> ----- Original Message -----
> From: "Ray Johnston" <[email protected]>
> To: <[email protected]>
> Sent: Thursday, November 13, 2003 10:20 PM
> Subject: [gs-cvs] gs/lib
>
>
>
>>Update of /cvs/ghostscript/gs/lib
>>In directory casper:/tmp/cvs-serv4207/lib
>>
>>Modified Files:
>>pdf_ops.ps
>>Log Message:
>>Fix: Adobe Acrobat Reader ignores an empty path when setting the clip
>>path. Bug #687136.
>>
>>DETAILS:
>>
>>We never encountered this problem in a 'real' file, but one of Raph's
>>test files showed the difference in the way our PDF interpreter handled
>>an zero area path to setting clipping versus the way Adobe does.
>>
>>Igor tested CPSI and determined that PostScript results in a zero area
>>clipping box, but Acrobat Reader works differently, so the patch detects
>>a zero area path and does not change the clipping path in that case.
>>
>>The details of the determination of 0 area is commented here:
>>
>>pathbbox % get the path bounding box
>>3 -1 roll % roll to get upper and lower Y coordinates together
>>sub abs % form absolute delta Y of path bbox
>>3 1 roll % roll upper and lower X coordinates to TOS
>>sub abs % form absolute delta X of path bbox
>>add % sum abs delta X and abs delta Y
>>0 ne % if it is non-zero, then perform the clip/eoclip
>>
>>
>>
>>Index: pdf_ops.ps
>>===================================================================
>>RCS file: /cvs/ghostscript/gs/lib/pdf_ops.ps,v
>>retrieving revision 1.32
>>retrieving revision 1.33
>>diff -u -d -r1.32 -r1.33
>>--- pdf_ops.ps 14 Oct 2003 10:15:38 -0000 1.32
>>+++ pdf_ops.ps 13 Nov 2003 19:20:36 -0000 1.33
>>@@ -368,12 +368,14 @@
>> /S { gsave setstrokestate stroke grestore n } bdef
>> /f { gsave setfillstate fill grestore n } bdef
>> /f* { gsave setfillstate eofill grestore n } bdef
>>-/n { end clip newpath } 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
>> /W*dict 4 dict dup begin
>> Wdict { def } forall
>>-/n { end eoclip newpath } 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 { eoclip }
>
> if newpath } bdef
>
>> end readonly def
>> /W* { //W*dict begin } bdef
>>
>>
>>_______________________________________________
>>gs-cvs mailing list
>>[email protected]
>>http://www.ghostscript.com/mailman/listinfo/gs-cvs
>>
>
>
> _______________________________________________
> gs-code-review mailing list
> [email protected]
> http://www.ghostscript.com/mailman/listinfo/gs-code-review
>
>