[gs-cvs] rev 8707 - trunk/gs/lib

alexcher at ghostscript.com alexcher at ghostscript.com
Tue May 6 13:59:54 PDT 2008


Author: alexcher
Date: 2008-05-06 13:59:54 -0700 (Tue, 06 May 2008)
New Revision: 8707

Modified:
   trunk/gs/lib/pdf_ops.ps
Log:
Fix and simplify implementation of operator Q. Collecting the path with
the current ctm and re-playing it with the restored ctm transforms the
path exactly as PDF needs. Bug 689812.

DIFFERENCES:
None


Modified: trunk/gs/lib/pdf_ops.ps
===================================================================
--- trunk/gs/lib/pdf_ops.ps	2008-05-05 20:56:17 UTC (rev 8706)
+++ trunk/gs/lib/pdf_ops.ps	2008-05-06 20:59:54 UTC (rev 8707)
@@ -94,25 +94,26 @@
    if def
  } bdef
 
-% Restore graphics state, but do not modify path. Paths are not part
-% of the PDF graphics state; see 4.4.1 of PDF reference 3rd ed.
-/grestore_nopath {
-  % Collect the upath with an identity CTM
-    matrix setmatrix .getpath
-    % Save the CTM, set identity during the uappend, then set the CTM
-    grestore matrix currentmatrix matrix setmatrix
-    exch newpath { exec } forall setmatrix
-} bdef
-
 /q {
   gsave //nodict begin
 } bdef
+
 % Some PDF files have excess Q operators!
 /Q {
   currentdict /self .knownget {
-    exec //nodict eq { end grestore_nopath false } { true } ifelse
+    exec //nodict eq {
+      end
+      % Restore graphics state, but do not modify path. Paths are not part
+      % of the PDF graphics state; see 4.4.1 of PDF reference 3rd ed.
+      % Collecting the path with one ctm and re-playing it with another ctm
+      % transforms the path exactly as PDF needs.
+      .getpath grestore newpath { exec } forall
+      //false
+    } {
+      //true
+    } ifelse
   } {
-    true	% formaterror -- not a gsave dict
+    //true	% formaterror -- not a gsave dict
   } ifelse
   { (\n   **** File has imbalanced q/Q operators \(too many Q's\) ****\n)
     pdfformaterror



More information about the gs-cvs mailing list