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

leonardo at ghostscript.com leonardo at ghostscript.com
Wed May 2 12:12:52 PDT 2007


Author: leonardo
Date: 2007-05-02 12:12:52 -0700 (Wed, 02 May 2007)
New Revision: 7894

Modified:
   trunk/gs/src/gscspace.c
Log:
Fix (shadings) : The color space linearity check didn't account the color precision.

DETAILS : 

This partially improves performance for the test case of 
the bug 689189 "PDF fails with /unregistered in --shfill--".

Since the color space represents color with precision 1/255,
the shadings code must not try to obtain a better precision.
This patch accounts the color quantum in is_dc_nearly_linear.

EXPECTED DIFFERENCES :

A minor difference in shading color :

"comparefiles\464-01-fixed.ps" 
"comparefiles\478-01.ps" 
"comparefiles\Clarke Tate Manns Chinese.ai" 
"comparefiles\Openhuis_pdf_zw.pdf" 
"comparefiles\STEUER-RollingMesh 1(linear).ai" 
"comparefiles\STEUER-RollingMesh 2(radial).ai" 
"comparefiles\STEUER-RollingMesh 3(Final).ai" 

"CET\09-47H.PS" 
"CET\12-14L.PS" 
"CET\12-14R.PS" 
"CET\12-14S.PS" 


Modified: trunk/gs/src/gscspace.c
===================================================================
--- trunk/gs/src/gscspace.c	2007-05-02 18:18:29 UTC (rev 7893)
+++ trunk/gs/src/gscspace.c	2007-05-02 19:12:52 UTC (rev 7894)
@@ -470,6 +470,7 @@
 	const gx_device_color *c0, const gx_device_color *c1, 
 	double t, int n, float smoothness)
 {
+
     if (c0->type == &gx_dc_type_data_pure) {
 	int i;
 	gx_color_index pure0 = c0->colors.pure;
@@ -481,11 +482,12 @@
 	    int mask = (1 << dev->color_info.comp_bits[i]) - 1;
 	    int max_color = (i == dev->color_info.gray_index ? dev->color_info.max_gray 
 							     : dev->color_info.max_color);
+	    float max_diff = max(1, max_color * smoothness);
 	    int b0 = (pure0 >> shift) & mask, b1 = (pure1 >> shift) & mask; 
 	    int b = (pure >> shift) & mask;
 	    double bb = b0 * t + b1 * (1 - t);
 
-	    if (any_abs(b - bb) > max_color * smoothness)
+	    if (any_abs(b - bb) > max_diff)
 		return false;
 	}
 	return true;



More information about the gs-cvs mailing list