[gs-cvs] rev 9428 - branches/smask_work/base

mvrhel at ghostscript.com mvrhel at ghostscript.com
Fri Jan 30 18:23:55 PST 2009


Author: mvrhel
Date: 2009-01-30 18:23:55 -0800 (Fri, 30 Jan 2009)
New Revision: 9428

Modified:
   branches/smask_work/base/gdevp14.c
   branches/smask_work/base/gdevp14.h
   branches/smask_work/base/gxistate.h
   branches/smask_work/base/gxshade6.c
   branches/smask_work/base/lib.mak
Log:
Fix to ensure shading fills do NOT occur in the device color space when we are within a transparency group with a different color space.  

DETAILS:  The previous fix for this was to alter the number of color components in the color info of the target device.  This is not a desirable approach since that value really should be private to the device.  A better approach is to introduce into the imager state a boolean that indicates if we are within a transparency group.  When the pattern color is created for the shading code and we pass through the pdf14clist fill path we now set this value true if we are within a transparency group.  The shading code has a check called is_linear_color_applicable which it uses to determine if it can do the shading in the target device color space.  If the boolean flag related to transparency is true, then it will keep the colors in the source space. To handle it in the device space would require knowing all the nested transparency group color spaces as well as the transparency values and blending operations.  

Modified: branches/smask_work/base/gdevp14.c
===================================================================
--- branches/smask_work/base/gdevp14.c	2009-01-30 21:10:55 UTC (rev 9427)
+++ branches/smask_work/base/gdevp14.c	2009-01-31 02:23:55 UTC (rev 9428)
@@ -44,6 +44,7 @@
 #include "gxdcconv.h"
 #include "vdtrace.h"
 #include "gscolorbuffer.h"
+#include "gsptype2.h"
 
 /* Visual  trace options : set one to 1. */
 #define VD_PAINT_MASK 0
@@ -2227,12 +2228,6 @@
     int new_num_comps,new_depth;
     bool new_additive;
 
-    /* Get the target device also.  The shading code
-       during clist writing uses the num of components. */
-
-    gx_device_forward * const fdev = (gx_device_forward *)dev;
-    gx_device *tdev = fdev->target;
-
     if_debug0('v', "[v]pdf14_update_device_color_procs_push_c\n");
 
    /* Check if we need to alter the device procs at this
@@ -2325,7 +2320,6 @@
             pdev->color_info.polarity = new_polarity;
             pdev->color_info.num_components = new_num_comps;
             pdev->pdf14_procs = new_14procs;
-            tdev->color_info.num_components = new_num_comps;
 
             if (pdev->ctx)
             {
@@ -2349,12 +2343,6 @@
     pdf14_device *pdev = (pdf14_device *)dev;
     pdf14_parent_color_t *parent_color = pdev->trans_group_parent_cmap_procs;
 
-    /* Get the target device also.  The shading code
-       during clist writing uses the num of components. */
-
-    gx_device_forward * const fdev = (gx_device_forward *)dev;
-    gx_device *tdev = fdev->target;
-
     if_debug0('v', "[v]pdf14_update_device_color_procs_pop_c\n");
   
     /* The color procs are always pushed.  Simply restore them. */
@@ -2374,7 +2362,6 @@
         pdev->color_info.num_components = parent_color->num_components;
         pdev->blend_procs = parent_color->parent_blending_procs;
         pdev->pdf14_procs = parent_color->unpack_procs;
-        tdev->color_info.num_components = parent_color->target_num_components;
 
         if (pdev->ctx){
             pdev->ctx->additive = parent_color->isadditive;
@@ -2413,12 +2400,6 @@
     pdf14_parent_color_t *parent_color_info = pdev->trans_group_parent_cmap_procs;
     pdf14_parent_color_t *new_parent_color;
 
-    /* Get the target device also.  The shading code
-       during clist writing uses the num of components. */
-
-    gx_device_forward * const fdev = (gx_device_forward *)dev;
-    gx_device *tdev = fdev->target;
-
     if_debug0('v', "[v]pdf14_push_parent_color\n");
 
     /* Allocate a new one */
@@ -2445,7 +2426,6 @@
     new_parent_color->polarity = pdev->color_info.polarity;
     new_parent_color->num_components = pdev->color_info.num_components;
     new_parent_color->unpack_procs = pdev->pdf14_procs;
-    new_parent_color->target_num_components = tdev->color_info.num_components;
 
     /* isadditive is only used in ctx */
     if (pdev->ctx)
@@ -4853,6 +4833,23 @@
     code = pdf14_clist_update_params(pdev, pis);
     if (code < 0)
 	return code;
+
+    /* If we are doing a shading fill and we are in a tranparency
+       group of a different color space, then we do not want to 
+       do the shading in the device color space. It must occur in
+       the source space.  To handle it in the device space would 
+       require knowing all the nested transparency group color spaces
+       as well as the transparency.  */
+
+    if (pdcolor != NULL && gx_dc_is_pattern2_color(pdcolor) && pdev->trans_group_parent_cmap_procs != NULL) {
+
+ 	gs_pattern2_instance_t *pinst =
+	    (gs_pattern2_instance_t *)pdcolor->ccolor.pattern;
+           gs_imager_state *pis_saved = (gs_imager_state *)(pinst->saved);
+           pis_saved->has_transparency = true;
+
+    }
+
     /*
      * The blend operations are not idempotent.  Force non-idempotent
      * filling and stroking operations.

Modified: branches/smask_work/base/gdevp14.h
===================================================================
--- branches/smask_work/base/gdevp14.h	2009-01-30 21:10:55 UTC (rev 9427)
+++ branches/smask_work/base/gdevp14.h	2009-01-31 02:23:55 UTC (rev 9428)
@@ -53,10 +53,6 @@
     const void * unpack_procs;
     const pdf14_nonseparable_blending_procs_t * parent_blending_procs;
     pdf14_parent_color_t *previous;
-    int target_num_components;  /* The shading code during clist writing uses
-                                   this.  We want it to handle it in the
-                                   group color space not the device color space */
-    
  
 };
 

Modified: branches/smask_work/base/gxistate.h
===================================================================
--- branches/smask_work/base/gxistate.h	2009-01-30 21:10:55 UTC (rev 9427)
+++ branches/smask_work/base/gxistate.h	2009-01-31 02:23:55 UTC (rev 9428)
@@ -231,6 +231,7 @@
 	bool text_knockout;\
 	uint text_rendering_mode;\
 	gs_transparency_state_t *transparency_stack;\
+        bool has_transparency;   /* used to keep from doing shading fills in device color space */\
 	bool overprint;\
 	int overprint_mode;\
 	int effective_overprint_mode;\
@@ -272,7 +273,7 @@
    { (float)(scale), 0.0, 0.0, (float)(-(scale)), 0.0, 0.0 },\
   false, {0, 0}, {0, 0}, false, \
   lop_default, gx_max_color_value, BLEND_MODE_Compatible,\
-  { 1.0 }, { 1.0 }, 0, 0/*false*/, 0, 0, 0/*false*/, 0, 0, 1.0,  \
+  { 1.0 }, { 1.0 }, 0, 0/*false*/, 0, 0, 0/*false*/, 0/*false*/, 0, 0, 1.0,  \
    { fixed_half, fixed_half }, 0/*false*/, 0/*false*/, 0/*false*/, 1.0,\
   1, INIT_CUSTOM_COLOR_PTR	/* 'Custom color' callback pointer */  \
   gx_default_get_cmap_procs

Modified: branches/smask_work/base/gxshade6.c
===================================================================
--- branches/smask_work/base/gxshade6.c	2009-01-30 21:10:55 UTC (rev 9427)
+++ branches/smask_work/base/gxshade6.c	2009-01-31 02:23:55 UTC (rev 9428)
@@ -190,6 +190,8 @@
 	return false;
     if (pfs->dev->color_info.separable_and_linear != GX_CINFO_SEP_LIN)
 	return false;
+    if (pfs->pis->has_transparency == true)
+        return false; /* set in pdf14 dev if we are in a trans group */
     if (gx_get_cmap_procs(pfs->pis, pfs->dev)->is_halftoned(pfs->pis, pfs->dev))
 	return false;
     return true;

Modified: branches/smask_work/base/lib.mak
===================================================================
--- branches/smask_work/base/lib.mak	2009-01-30 21:10:55 UTC (rev 9427)
+++ branches/smask_work/base/lib.mak	2009-01-31 02:23:55 UTC (rev 9428)
@@ -2597,7 +2597,8 @@
  $(gscdefs_h) $(gxdevice_h) $(gsdevice_h) $(gsstruct_h) $(gscoord_h) $(gxistate_h) $(gxdcolor_h)\
  $(gxiparam_h) $(gstparam_h) $(gxblend_h) $(gxtext_h) $(gsdfilt_h) $(gsimage_h)\
  $(gsrect_h) $(gzstate_h) $(gdevdevn_h) $(gdevp14_h) $(gsovrc_h) $(gxcmap_h) $(gscolor1_h)\
- $(gstrans_h) $(gsutil_h) $(gxcldev_h) $(gxclpath_h) $(gxdcconv_h) $(vdtrace_h) $(gscolorbuffer_h)
+ $(gstrans_h) $(gsutil_h) $(gxcldev_h) $(gxclpath_h) $(gxdcconv_h) $(vdtrace_h)\
+ $(gscolorbuffer_h) $(gsptype2_h)
 	$(GLCC) $(GLO_)gdevp14.$(OBJ) $(C_) $(GLSRC)gdevp14.c
 
 translib_=$(GLOBJ)gstrans.$(OBJ) $(GLOBJ)gximag3x.$(OBJ)\



More information about the gs-cvs mailing list