RE: stefan's bittagging patch

"Dan Coby" <[email protected]> Tue, 29 Aug 2006 16:18:59 -0700
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
This is a multi-part message in MIME format.

------=_NextPart_000_008B_01C6CB86.D59B0380
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit


Ralph,

Since your purpose is bring the GS and PCL branches together, I
have no objection to making this commit.  Committing this stuff
is probably the quickest and easiest path toward a single tree.

There are several things that I do not like.  I think that they
can be corrected after you commit this stuff.

1)  I still have to finish 688638 'Make ROPs and overprinting
compatible'.  This is key to resolving your questions about the
various map_color_rgb routines.  Obviously this is critical for a
language switch build which needs to support both PCL ROPs and
PS/PDF overprinting.  I am bumping this to the top of my queue.

2)  Someone decided to define gs_bitrgbtags_device with a giant
structure initialization instead of using the various device
macros.  I do not know why.  It makes for very fragile code since
if someone adds a field to the gs_device or gs_prn_device structures,
then the initialization will fail.  (Fortunately I think that it
will be a compiler failure instead of silently putting the wrong
data into device fields.)  I realize the device macros are
pretty unobvious to use.  However this structure initialization is
even worse since there are not even comments indicating what fields
are being initialized.  Instead there is over one hundred lines
of obscure numbers without any explanation.  This is particularly bad
since this is supposed to be an example of how to do device level
object tagging.

3.  I am not really thrilled about some of the hacks for detecting
text versus vectors in the object tagging logic.  Igor has already
commented on this issue.  I am enclosing a diff for the relevant
changes that I made for custom color processing and switchable CRDs
(two other places that also want to make color processing decisions
based upon the object tag.

Note:  I used the term 'object type' in my code instead of Stefan's
term 'object tag'.  Stefan's term is probably better since 'object type'
is too generic.  I will change my nomenclature to match his.

Basically I set the object tag before setting the device color
when processing an object.  Thus it is being done a little higher
in the processing chain than Stefan's version.  I believe that this
eliminates the guess work required about text versus vectors.  It
works with all of the test files that I have tried.  It even found
some strange cases in the altona test suites.  (The custom color
processing code simplifies testing since one of its demos changes
all text to red, all images to green, and all vectors/fills to blue.
Thus you can look at the object type on the display.)


I suggest that we proceed as follows:
a)  You commit your patch for Stefan's object tagging.
b)  I modify my custom color processing logic to use Stefan's
nomenclature and also to include his BITTAG global value.
c)  I commit my changes which pulls Stefan's version of setting the
object tag and replaces it with mine.
d)  I straighten out 688638 and commit this fix.

I am hopeful that I only have to do my commits to a single tree (gs head).


Dan


-----Original Message-----
From: Ralph Giles [mailto:[email protected]]
Sent: Monday, August 28, 2006 11:11 PM
To: [email protected]
Cc: [email protected]
Subject: stefan's bittagging patch


Dan,

This is (I hope!) the complete patch for stefan's bittagging work 
from the GhostPCL branch. I've not tested it or resolved the conflict 
with your commit in r6702 as a fix for 688638.

This patch is also missing makefile dependency updates for the new 
headers.

If you want to do that and apply to gs trunk, that would be great. If 
you don't have time let me know and I'll do it.

 -r


------=_NextPart_000_008B_01C6CB86.D59B0380
Content-Type: application/octet-stream;
	name="object_tag.dif"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="object_tag.dif"

Index: src/gsimage.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/gsimage.c	(revision 7001)
+++ src/gsimage.c	(working copy)
@@ -156,6 +156,7 @@
 =0A=
     if (code < 0)=0A=
 	return code;=0A=
+    set_object_type(pgs, IMAGE_OBJECT);	/* Processing an image object =
operation */=0A=
     if (uses_color) {=0A=
 	gx_set_dev_color(pgs);=0A=
         code =3D gs_state_color_load(pgs);=0A=
Index: src/gxistate.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/gxistate.h	(revision 7001)
+++ src/gxistate.h	(working copy)
@@ -117,6 +117,32 @@
     gx_transfer_map *gray;		/* (RC) */=0A=
 } gx_transfer;=0A=
 =0A=
+/*=0A=
+ * Definitions for selecting object/CRD types.=0A=
+ */=0A=
+typedef enum {=0A=
+	FILL_OBJECT =3D 1,=0A=
+	TEXT_OBJECT =3D 2,=0A=
+	IMAGE_OBJECT =3D 3=0A=
+} crd_type_t;=0A=
+=0A=
+/*=0A=
+ * If the client is doing special processing of color spaces then unset=0A=
+ * the color every time that the object type is changed.  This is done =
since=0A=
+ * the client may be doing object type specific color processing.=0A=
+ */=0A=
+#if ENABLE_CUSTOM_COLOR_CALLBACK	/* Defined in src/gsnamecl.h */=0A=
+#define set_object_type(pgs, obj_type) \=0A=
+    if (pgs->object_type !=3D obj_type) {\=0A=
+	pgs->object_type =3D obj_type;\=0A=
+        if (pgs->custom_color_callback !=3D NULL) \=0A=
+	    gx_unset_dev_color(pgs);\=0A=
+    }=0A=
+#else 	/* else !ENABLE_CUSTOM_COLOR_CALLBACK */=0A=
+#define set_object_type(pgs, obj_type) \=0A=
+    pgs->object_type =3D obj_type;=0A=
+#endif 	/* !ENABLE_CUSTOM_COLOR_CALLBACK */=0A=
+=0A=
 #define gs_color_rendering_state_common\=0A=
 \=0A=
 		/* Halftone screen: */\=0A=
@@ -138,6 +164,7 @@
 		/* effective_transfer are always the same.) */\=0A=
 	gx_transfer set_transfer;		/* members are (RC) */\=0A=
 	gx_transfer_map *effective_transfer[GX_DEVICE_COLOR_MAX_COMPONENTS]; =
/* see below */\=0A=
+	int object_type; /* */\=0A=
 \=0A=
 		/* Color caches: */\=0A=
 \=0A=
Index: src/gspaint.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/gspaint.c	(revision 7001)
+++ src/gspaint.c	(working copy)
@@ -69,6 +69,7 @@
     gs_logical_operation_t save_lop;=0A=
     bool hl_color_available;=0A=
 =0A=
+    set_object_type(pgs, FILL_OBJECT);	/* Processing a fill object =
operation */=0A=
     gx_set_dev_color(pgs);=0A=
     hl_color_available =3D =
gx_hld_is_hl_color_available((gs_imager_state *)pgs, =0A=
 						    pgs->dev_color);=0A=
@@ -269,6 +270,7 @@
     } else {=0A=
 	int abits, acode, rcode =3D 0;=0A=
 =0A=
+        set_object_type(pgs, FILL_OBJECT); /* Processing a fill object =
operation */=0A=
 	gx_set_dev_color(pgs);=0A=
 	code =3D gs_state_color_load(pgs);=0A=
 	if (code < 0)=0A=
@@ -335,6 +337,7 @@
     } else {=0A=
 	int abits, acode, rcode =3D 0;=0A=
 =0A=
+        set_object_type(pgs, FILL_OBJECT); /* Processing a fill object =
operation */=0A=
 	gx_set_dev_color(pgs);=0A=
 	code =3D gs_state_color_load(pgs);=0A=
 	if (code < 0)=0A=
Index: src/gstext.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/gstext.c	(revision 7001)
+++ src/gstext.c	(working copy)
@@ -236,6 +236,7 @@
        of a Type 3 font while stringwidth. =0A=
        Unfortunately we can't effectively know a leaf font type here,=0A=
        so we load the color unconditionally . */=0A=
+    set_object_type(pgs, TEXT_OBJECT); /* Processing a text object =
operation */=0A=
     gx_set_dev_color(pgs);=0A=
     code =3D gs_state_color_load(pgs);=0A=
     if (code < 0)=0A=
@@ -260,6 +261,7 @@
      * update of the graphic state color will update the text color as=0A=
      * well.=0A=
      */=0A=
+    set_object_type(pgs, TEXT_OBJECT); /* Processing a text object =
operation */=0A=
     if (pte->pdcolor !=3D 0)=0A=
         gx_set_dev_color(pgs);=0A=
     return 0;=0A=
Index: src/gsdps1.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- src/gsdps1.c	(revision 7001)
+++ src/gsdps1.c	(working copy)
@@ -153,6 +153,7 @@
 		dev_proc(pdev, fill_rectangle_hl_color)(pdev, =0A=
 		    	    &empty, pis, pdc, NULL) =3D=3D 0);=0A=
 =0A=
+    set_object_type(pgs, FILL_OBJECT);	/* Processing a fill object =
operation */=0A=
     gx_set_dev_color(pgs);=0A=
     if ((is_fzero2(pgs->ctm.xy, pgs->ctm.yx) ||=0A=
 	 is_fzero2(pgs->ctm.xx, pgs->ctm.yy)) &&=0A=

------=_NextPart_000_008B_01C6CB86.D59B0380
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
gs-code-review mailing list
[email protected]
http://www.ghostscript.com/mailman/listinfo/gs-code-review

------=_NextPart_000_008B_01C6CB86.D59B0380--