[gs-cvs] rev 7155 - trunk/gs/src

raph at ghostscript.com raph at ghostscript.com
Fri Nov 3 12:43:14 PST 2006


Author: raph
Date: 2006-11-03 12:43:13 -0800 (Fri, 03 Nov 2006)
New Revision: 7155

Modified:
   trunk/gs/src/gsstate.c
Log:
Fix: Fixes clipsave/cliprestore nested with gsave operations. Correct
behavior is to save clipstack into saved gstate, and clear the clipstack
in the current graphics state, as clarified in PLRM3. Fixes 450-01.ps and
CET 09-54-2 et al, and 11-06-2.


Modified: trunk/gs/src/gsstate.c
===================================================================
--- trunk/gs/src/gsstate.c	2006-11-03 19:20:58 UTC (rev 7154)
+++ trunk/gs/src/gsstate.c	2006-11-03 20:43:13 UTC (rev 7155)
@@ -312,13 +312,15 @@
 
     if (pnew == 0)
 	return_error(gs_error_VMerror);
-    /*
-     * It isn't clear from the Adobe documentation whether gsave retains
-     * the current clip stack or clears it.  The following statement
-     * bets on the latter.  If it's the former, this should become
-     *	rc_increment(pnew->clip_stack);
+    /* As of PLRM3, the interaction between gsave and the clip stack is
+     * now clear. gsave stores the clip stack into the saved graphics
+     * state, but then clears it in the current graphics state.
+     *
+     * Ordinarily, reference count rules would indicate an rc_decrement()
+     * on pgs->clip_stack, but gstate_clone() has an exception for
+     * the clip_stack and dfilter_stack fields.
      */
-    pnew->clip_stack = 0;
+    pgs->clip_stack = 0;
     rc_increment(pnew->dfilter_stack);
     pgs->saved = pnew;
     if (pgs->show_gstate == pgs)



More information about the gs-cvs mailing list