[gs-cvs] rev 7453 - in trunk/gs: doc lib src

alexcher at ghostscript.com alexcher at ghostscript.com
Wed Dec 6 11:59:50 PST 2006


Author: alexcher
Date: 2006-12-06 11:59:48 -0800 (Wed, 06 Dec 2006)
New Revision: 7453

Modified:
   trunk/gs/doc/pscet_status.txt
   trunk/gs/lib/gs_ll3.ps
   trunk/gs/src/ifunc.h
   trunk/gs/src/zfunc.c
   trunk/gs/src/zfunc3.c
   trunk/gs/src/zshade.c
Log:
Modify gs to match 12-14c test case:
- check that the function domain covers all of the shading domain.
- do this test early - before checking other parameters.
- tweak error handling in shfill on PostScript level to match the test.

DIFFERENCES:
None


Modified: trunk/gs/doc/pscet_status.txt
===================================================================
--- trunk/gs/doc/pscet_status.txt	2006-12-06 01:33:52 UTC (rev 7452)
+++ trunk/gs/doc/pscet_status.txt	2006-12-06 19:59:48 UTC (rev 7453)
@@ -2513,8 +2513,7 @@
 
 12-14B-1  OK	All test report errors now match CPSI and the test. - Alex
 
-12-14C-1  DIFF	GS error inconformity.
-		assign: Alex.
+12-14C-1  OK  	Fixed - Alex.
 
 12-14D-1  OK  	Fixed in rev. 7209. - Alex
 

Modified: trunk/gs/lib/gs_ll3.ps
===================================================================
--- trunk/gs/lib/gs_ll3.ps	2006-12-06 01:33:52 UTC (rev 7452)
+++ trunk/gs/lib/gs_ll3.ps	2006-12-06 19:59:48 UTC (rev 7453)
@@ -240,6 +240,11 @@
   /CloseSource true
 .dicttomark readonly put
 /.buildshading {	% <shadingdict> .buildshading <shading>
+  dup rcheck not {
+      % Adobe seems to access ColorSpace first and CET 12-14c checks this.
+      /$error .systemvar /errorinfo [ /ColorSpace null ] put
+      /shfill .systemvar /invalidaccess signalerror
+  } if
         % Unfortunately, we always need to make the DataSource reusable,
         % because if clipping is involved, even shfill may need to read
         % the source data multiple times.  If it weren't for this,
@@ -306,9 +311,15 @@
 	% Currently, .shfill requires that the color space
 	% in the pattern be the current color space.
 	% Disable overprintmode for shfill
-  dup gsave
-  0 .setoverprintmode { .buildshading .shfill } stopped
-  grestore { stop } if
+  { dup gsave 0 .setoverprintmode .buildshading .shfill } stopped
+  grestore {
+    /$error .systemvar /errorinfo 2 copy known {
+      pop pop
+    } {
+      //null put  % CET 12-14c
+    } ifelse
+    stop
+  } if
   pop
 } odef
 

Modified: trunk/gs/src/ifunc.h
===================================================================
--- trunk/gs/src/ifunc.h	2006-12-06 01:33:52 UTC (rev 7452)
+++ trunk/gs/src/ifunc.h	2006-12-06 19:59:48 UTC (rev 7453)
@@ -35,9 +35,9 @@
 
 /* Build a function structure from a PostScript dictionary. */
 int fn_build_function(i_ctx_t *i_ctx_p, const ref * op, gs_function_t ** ppfn,
-		      gs_memory_t *mem);
+      gs_memory_t *mem, const float *shading_domain, const int num_inputs);
 int fn_build_sub_function(i_ctx_t *i_ctx_p, const ref * op, gs_function_t ** ppfn,
-			  int depth, gs_memory_t *mem);
+  int depth, gs_memory_t *mem, const float *shading_domain, const int num_inputs);
 
 /*
  * Collect a heap-allocated array of floats.  If the key is missing, set

Modified: trunk/gs/src/zfunc.c
===================================================================
--- trunk/gs/src/zfunc.c	2006-12-06 01:33:52 UTC (rev 7452)
+++ trunk/gs/src/zfunc.c	2006-12-06 19:59:48 UTC (rev 7453)
@@ -55,7 +55,7 @@
 {
     os_ptr op = osp;
     gs_function_t *pfn;
-    int code = fn_build_function(i_ctx_p, op, &pfn, imemory);
+    int code = fn_build_function(i_ctx_p, op, &pfn, imemory, 0, 0);
 
     if (code < 0)
 	return code;
@@ -200,15 +200,16 @@
 
 /* Build a function structure from a PostScript dictionary. */
 int
-fn_build_function(i_ctx_t *i_ctx_p, const ref * op, gs_function_t ** ppfn, gs_memory_t *mem)
+fn_build_function(i_ctx_t *i_ctx_p, const ref * op, gs_function_t ** ppfn, gs_memory_t *mem,
+    const float *shading_domain, const int num_inputs)
 {
-    return fn_build_sub_function(i_ctx_p, op, ppfn, 0, mem);
+    return fn_build_sub_function(i_ctx_p, op, ppfn, 0, mem, shading_domain, num_inputs);
 }
 int
 fn_build_sub_function(i_ctx_t *i_ctx_p, const ref * op, gs_function_t ** ppfn,
-		      int depth, gs_memory_t *mem)
+    int depth, gs_memory_t *mem, const float *shading_domain, const int num_inputs)
 {
-    int code, type;
+    int j, code, type;
     uint i;
     gs_function_params_t params;
 
@@ -232,6 +233,32 @@
 	goto fail;
     }
     params.m = code >> 1;
+    for (j = 0; j < params.m << 1; j += 2) {
+        if (params.Domain[j] > params.Domain[j + 1]) {
+          code = gs_note_error(e_rangecheck);
+          gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Domain"); 
+  	  goto fail;
+        }
+    }
+    if (shading_domain) {
+        /* Each function dictionary’s domain must be a superset of that of
+         * the shading dictionary. PLRM3 p.265. CET 12-14c. We do this check
+         * here because Adobe checks Domain before checking other parameters.
+         */
+        if (num_inputs != params.m)
+            code = gs_note_error(e_rangecheck);
+        for (j = 0; j < 2*num_inputs && code >= 0; j += 2) {
+            if (params.Domain[j] > shading_domain[j] ||
+                params.Domain[j+1] < shading_domain[j+1]
+               ) {
+                code = gs_note_error(e_rangecheck);
+            }
+        }
+        if (code < 0) {
+            gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Domain");
+            goto fail;
+        }
+    }
     code = fn_build_float_array(op, "Range", false, true, &params.Range, mem);
     if (code < 0)
 	goto fail;

Modified: trunk/gs/src/zfunc3.c
===================================================================
--- trunk/gs/src/zfunc3.c	2006-12-06 01:33:52 UTC (rev 7452)
+++ trunk/gs/src/zfunc3.c	2006-12-06 19:59:48 UTC (rev 7453)
@@ -92,7 +92,7 @@
 	    ref subfn;
 
 	    array_get(mem, pFunctions, (long)i, &subfn);
-	    code = fn_build_sub_function(i_ctx_p, &subfn, &ptr[i], depth, mem);
+	    code = fn_build_sub_function(i_ctx_p, &subfn, &ptr[i], depth, mem, 0, 0);
 	    if (code < 0)
 		goto fail;
 	}

Modified: trunk/gs/src/zshade.c
===================================================================
--- trunk/gs/src/zshade.c	2006-12-06 01:33:52 UTC (rev 7452)
+++ trunk/gs/src/zshade.c	2006-12-06 19:59:48 UTC (rev 7453)
@@ -242,7 +242,7 @@
 /* Collect a Function value. */
 private int
 build_shading_function(i_ctx_t *i_ctx_p, const ref * op, gs_function_t ** ppfn,
-		       int num_inputs, gs_memory_t *mem)
+	         int num_inputs, gs_memory_t *mem, const float *shading_domain)
 {
     ref *pFunction;
     int code;
@@ -266,7 +266,8 @@
 	    ref rsubfn;
 
 	    array_get(imemory, pFunction, (long)i, &rsubfn);
-	    code = fn_build_function(i_ctx_p, &rsubfn, &Functions[i], mem);
+	    code = fn_build_function(i_ctx_p, &rsubfn, &Functions[i], mem,
+               shading_domain, num_inputs);
 	    if (code < 0)
 		break;
 	}
@@ -280,7 +281,8 @@
 	if (code < 0)
 	    gs_function_AdOt_free_params(&params, mem);
     } else {
-	code = fn_build_function(i_ctx_p, pFunction, ppfn, mem);
+	code = fn_build_function(i_ctx_p, pFunction, ppfn, mem,
+            shading_domain, num_inputs);
 	if (code < 0)
 	    return code;
 	if ((*ppfn)->params.m != num_inputs) {
@@ -340,11 +342,9 @@
             goto out;
         }
     }
-    code = build_shading_function(i_ctx_p, op, &params.Function, 2, mem);
-    if (code < 0) {
-	gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Function");
+    code = build_shading_function(i_ctx_p, op, &params.Function, 2, mem, params.Domain);
+    if (code < 0)
         goto out;
-    }
     if (params.Function == 0) {  /* Function is required */
 	code = gs_note_error(e_undefined);
 	gs_errorinfo_put_pair_from_dict(i_ctx_p, op, "Function");
@@ -381,7 +381,7 @@
     if (code < 0 ||
 	(code = dict_floats_param_errorinfo(i_ctx_p, op, "Domain", 2, Domain,
 				  default_Domain)) < 0 ||
-	(code = build_shading_function(i_ctx_p, op, pFunction, 1, mem)) < 0
+	(code = build_shading_function(i_ctx_p, op, pFunction, 1, mem, Domain)) < 0
 	)
 	return code;
     if (!*pFunction)
@@ -506,7 +506,7 @@
 	    default:
 		return_error(e_typecheck);
 	}
-    code = build_shading_function(i_ctx_p, op, pFunction, 1, mem);
+    code = build_shading_function(i_ctx_p, op, pFunction, 1, mem, NULL);
     if (code < 0) {
 	gs_free_object(mem, data, "build_mesh_shading");
 	return code;



More information about the gs-cvs mailing list