Fix for

Alex Cherepanov <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Organization Coscript Software
Message-ID <[email protected]>
Return correct /DeviceGray color space from currentcolorspace operator
inside PaintProc of the uncolored pattern and cache device (bug 627169).
Use igs->color_space to track the current color space.
Fix bug 687080 from customer 710.

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review
zcolor.c.diff (text/plain, 2.1 KB)
Index: gs/src/zcolor.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/zcolor.c,v
retrieving revision 1.15
diff -b -u -r1.15 zcolor.c
--- gs/src/zcolor.c	14 Oct 2003 12:43:19 -0000	1.15
+++ gs/src/zcolor.c	17 Oct 2003 11:29:28 -0000
@@ -16,6 +16,7 @@
 
 /* $Id: zcolor.c,v 1.15 2003/10/14 12:43:19 igor Exp $ */
 /* Color operators */
+#include "memory_.h"
 #include "ghost.h"
 #include "oper.h"
 #include "estack.h"
@@ -127,15 +128,25 @@
     os_ptr  op = osp;   /* required by "push" macro */
 
     push(1);
-    if ( igs->in_cachedevice ) {
+    if ( gs_color_space_get_index(igs->color_space) == gs_color_space_index_DeviceGray ) {
+        ref gray, graystr;
+        ref csa = istate->colorspace.array; 
+        if (array_get(&csa, 0, &gray) >= 0 && 
+            r_has_type(&gray, t_name) && 
+	    (name_string_ref(&gray, &graystr),
+	    r_size(&graystr) == 10 &&
+	    !memcmp(graystr.value.bytes, "DeviceGray", 10))) {
+            
+            *op = istate->colorspace.array;
+        } else {
 	int code = ialloc_ref_array(op, a_all, 1, "currentcolorspace");
 	if (code < 0)
 	    return code;
 	return name_enter_string("DeviceGray", op->value.refs);
-    } else {
+        }
+    } else
         *op = istate->colorspace.array;
         return 0;
-    }
 }
 
 /*
Index: gs/src/int.mak
===================================================================
RCS file: /cvs/ghostscript/gs/src/int.mak,v
retrieving revision 1.116
diff -b -u -r1.116 int.mak
--- gs/src/int.mak	11 Sep 2003 21:12:18 -0000	1.116
+++ gs/src/int.mak	17 Oct 2003 11:29:34 -0000
@@ -436,7 +436,8 @@
  $(idict_h) $(ifont_h) $(igstate_h) $(iname_h) $(store_h)
 	$(PSCC) $(PSO_)zcharout.$(OBJ) $(C_) $(PSSRC)zcharout.c
 
-$(PSOBJ)zcolor.$(OBJ) : $(PSSRC)zcolor.c $(OP) $(estack_h) $(ialloc_h)\
+$(PSOBJ)zcolor.$(OBJ) : $(PSSRC)zcolor.c $(OP)\
+ $(memory__h) $(estack_h) $(ialloc_h)\
  $(igstate_h) $(iutil_h) $(store_h) $(gxfixed_h) $(gxmatrix_h)\
  $(gzstate_h) $(gxdcolor_h) $(gxdevice_h) $(gxdevmem_h) $(gxcmap_h)\
  $(gxcspace_h) $(gxcolor2_h) $(gxpcolor_h)\
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.