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

leonardo at ghostscript.com leonardo at ghostscript.com
Fri Nov 17 15:58:39 PST 2006


Author: leonardo
Date: 2006-11-17 15:58:38 -0800 (Fri, 17 Nov 2006)
New Revision: 7210

Modified:
   trunk/gs/src/gxshade.c
   trunk/gs/src/gxshade4.c
Log:
Fix (shadings) : Restrict shading function data with the shading function Domain.

DETAILS :

1. Restricts the function argument data (CET 09-47M.PS, SpecialTestL04Test04);
   CPSI appears to restrict shading function data with no warning.
   The old code throws a rangecheck.

2. Restricts color data with the color space Domain for triangle mesh shadings.
   The old code did not. Changing it to work same as for patch shadings.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gxshade.c
===================================================================
--- trunk/gs/src/gxshade.c	2006-11-17 05:28:16 UTC (rev 7209)
+++ trunk/gs/src/gxshade.c	2006-11-17 23:58:38 UTC (rev 7210)
@@ -264,9 +264,18 @@
 	int ncomp = (cs->params->Function != 0 ? 1 :
 		     gs_color_space_num_components(pcs));
 
-	for (i = 0; i < ncomp; ++i)
+	for (i = 0; i < ncomp; ++i) {
 	    if ((code = cs->get_decoded(cs, num_bits, decode + i * 2, &pc[i])) < 0)
 		return code;
+	    if (cs->params->Function) {
+		gs_function_params_t *params = &cs->params->Function->params;
+
+		if (pc[i] < params->Domain[i + i])
+		    pc[i] = params->Domain[i + i];
+		else if (pc[i] > params->Domain[i + i + 1])
+		    pc[i] = params->Domain[i + i + 1];
+	    }
+	}
     }
     return 0;
 }

Modified: trunk/gs/src/gxshade4.c
===================================================================
--- trunk/gs/src/gxshade4.c	2006-11-17 05:28:16 UTC (rev 7209)
+++ trunk/gs/src/gxshade4.c	2006-11-17 23:58:38 UTC (rev 7210)
@@ -58,7 +58,8 @@
 	/* Decode the color with the function. */
 	code = gs_function_evaluate(psh->params.Function, c->t,
 				    c->cc.paint.values);
-    }
+    } else
+	psh->params.ColorSpace->type->restrict_color(&c->cc, psh->params.ColorSpace);
     return code;
 }
 



More information about the gs-cvs mailing list