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

leonardo at ghostscript.com leonardo at ghostscript.com
Wed May 2 14:20:42 PDT 2007


Author: leonardo
Date: 2007-05-02 14:20:41 -0700 (Wed, 02 May 2007)
New Revision: 7895

Modified:
   trunk/gs/src/gxshade1.c
   trunk/gs/src/gxshade4.h
   trunk/gs/src/gxshade6.c
Log:
Fix (shadings) : Extra subdivision of axial and radial shadings.

DETAILS : 

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

The old code wrongly mapped shading function arguments
fro axial and radial shadings. It caused an
extra subdivision by U when the color function requires
to subdivide by V.

EXPECTED DIFFERENCES :

A minor difference in shading color :

"CompareFiles\shadings\442-01.ps" 
"CompareFiles\shadings\464-01-fixed.ps" 
"CompareFiles\shadings\483-01.ps" 
"CompareFiles\shadings\chilis_black.pdf" 
"CompareFiles\shadings\Clarke Tate Manns Chinese.ai" 
"CompareFiles\shadings\STEUER-RollingMesh 1(linear).ai" 
"CompareFiles\shadings\STEUER-RollingMesh 2(radial).ai" 
"CompareFiles\shadings\STEUER-RollingMesh 3(Final).ai" 
"CompareFiles\shadings\Bug688631.pdf"

"CET\shading\09-47A.PS" 
"CET\shading\09-47B.PS" 
"CET\shading\09-47D.PS" 
"CET\shading\09-47E.PS" 
"CET\shading\09-47F.PS" 
"CET\shading\09-47H.PS" 
"CET\shading\09-47I.PS" 
"CET\shading\12-14A.PS" 
"CET\shading\12-14H.PS" 
"CET\shading\12-14I.PS" 
"CET\shading\12-14J.PS" 
"CET\shading\12-14L.PS" 
"CET\shading\12-14M.PS" 
"CET\shading\12-14R.PS" 
"CET\shading\12-14S.PS" 
"CET\shading\12-14T.PS" 


Modified: trunk/gs/src/gxshade1.c
===================================================================
--- trunk/gs/src/gxshade1.c	2007-05-02 19:12:52 UTC (rev 7894)
+++ trunk/gs/src/gxshade1.c	2007-05-02 21:20:41 UTC (rev 7895)
@@ -182,10 +182,14 @@
     gs_point_transform2fixed(&pfs1->pis->ctm, x1 + pfs->delta.y * h0, y1 - pfs->delta.x * h0, &curve[1].vertex.p);
     gs_point_transform2fixed(&pfs1->pis->ctm, x1 + pfs->delta.y * h1, y1 - pfs->delta.x * h1, &curve[2].vertex.p);
     gs_point_transform2fixed(&pfs1->pis->ctm, x0 + pfs->delta.y * h1, y0 - pfs->delta.x * h1, &curve[3].vertex.p);
-    curve[0].vertex.cc[0] = curve[0].vertex.cc[1] = pfs->t0; /* The element cc[1] is set to a dummy value against */
-    curve[1].vertex.cc[0] = curve[1].vertex.cc[1] = pfs->t1; /* interrupts while an idle priocessing in gxshade.6.c .  */
-    curve[2].vertex.cc[0] = curve[2].vertex.cc[1] = pfs->t1;
-    curve[3].vertex.cc[0] = curve[3].vertex.cc[1] = pfs->t0;
+    curve[0].vertex.cc[0] = pfs->t0; /* The element cc[1] is set to a dummy value against */
+    curve[1].vertex.cc[0] = pfs->t1; /* interrupts while an idle priocessing in gxshade.6.c .  */
+    curve[2].vertex.cc[0] = pfs->t1;
+    curve[3].vertex.cc[0] = pfs->t0;
+    curve[0].vertex.cc[1] = 0; /* The element cc[1] is set to a dummy value against */
+    curve[1].vertex.cc[1] = 0; /* interrupts while an idle priocessing in gxshade.6.c .  */
+    curve[2].vertex.cc[1] = 0;
+    curve[3].vertex.cc[1] = 0;
     make_other_poles(curve);
     return patch_fill(pfs1, curve, NULL, NULL);
 }
@@ -215,6 +219,7 @@
     if (code < 0)
 	return code;
     pfs1.maybe_self_intersecting = false;
+    pfs1.function_arg_shift = 1;
     /*
      * Compute the parameter range.  We construct a matrix in which
      * (0,0) corresponds to t = 0 and (0,1) corresponds to t = 1,
@@ -697,6 +702,7 @@
     code = init_patch_fill_state(&pfs1);
     if (code < 0)
 	return code;
+    pfs1.function_arg_shift = 1;
     pfs1.rect = *clip_rect;
     pfs1.maybe_self_intersecting = false;
     code = R_extensions(&pfs1, psh, rect, d0, d1, psh->params.Extend[0], false);

Modified: trunk/gs/src/gxshade4.h
===================================================================
--- trunk/gs/src/gxshade4.h	2007-05-02 19:12:52 UTC (rev 7894)
+++ trunk/gs/src/gxshade4.h	2007-05-02 21:20:41 UTC (rev 7895)
@@ -118,6 +118,7 @@
 typedef struct patch_fill_state_s {
     mesh_fill_state_common;
     const gs_function_t *Function;
+    int function_arg_shift;
     bool vectorization;
     int n_color_args;
     fixed max_small_coord; /* Length restriction for intersection_of_small_bars. */

Modified: trunk/gs/src/gxshade6.c
===================================================================
--- trunk/gs/src/gxshade6.c	2007-05-02 19:12:52 UTC (rev 7894)
+++ trunk/gs/src/gxshade6.c	2007-05-02 21:20:41 UTC (rev 7895)
@@ -201,6 +201,7 @@
     pfs->vectorization = false; /* A stub for a while. Will use with pclwrite. */
     pfs->maybe_self_intersecting = true;
     pfs->monotonic_color = (pfs->Function == NULL);
+    pfs->function_arg_shift = 0;
     pfs->linear_color = false;
     pfs->inside = false;
     pfs->n_color_args = 1;
@@ -2343,14 +2344,15 @@
 is_quadrangle_color_monotonic(const patch_fill_state_t *pfs, const quadrangle_patch *p, 
 			      bool *not_monotonic_by_u, bool *not_monotonic_by_v) 
 {   /* returns : 1 = monotonic, 0 = don't know, <0 = error. */
-    int code;
+    int code, r;
 
     code = isnt_color_monotonic(pfs, p->p[0][0]->c, p->p[1][1]->c);
     if (code <= 0)
 	return code;
-    if (code & 1)
+    r = code << pfs->function_arg_shift;
+    if (r & 1)
 	*not_monotonic_by_u = true;
-    if (code & 2)
+    if (r & 2)
 	*not_monotonic_by_v = true;
     return !code;
 }



More information about the gs-cvs mailing list