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

leonardo at ghostscript.com leonardo at ghostscript.com
Tue Apr 10 10:13:41 PDT 2007


Author: leonardo
Date: 2007-04-10 10:13:41 -0700 (Tue, 10 Apr 2007)
New Revision: 7840

Modified:
   trunk/gs/src/gxpcmap.c
   trunk/gs/src/gxpcolor.h
   trunk/gs/src/zpcolor.c
Log:
Implementing high level patterns, step 3.

DETAILS : 

This is a preparation for fixing the bug 688396, step 3.
This change is algorithmically equivalent.
It encapsulates the initialization of gx_device_pattern_accum fields 
inside gx_pattern_accum_alloc, so that its clients must not deal
with a specific type of a pattern accumulation device.

Note: the 2 previous steps has a different title than
"Implementing high level patterns". 
They to be renamed.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gxpcmap.c
===================================================================
--- trunk/gs/src/gxpcmap.c	2007-04-10 06:54:36 UTC (rev 7839)
+++ trunk/gs/src/gxpcmap.c	2007-04-10 17:13:41 UTC (rev 7840)
@@ -139,7 +139,8 @@
 
 /* Allocate a pattern accumulator, with an initial refct of 0. */
 gx_device_pattern_accum *
-gx_pattern_accum_alloc(gs_memory_t * mem, client_name_t cname)
+gx_pattern_accum_alloc(gs_memory_t * mem, gs_memory_t * stoarge_memory, 
+		       gs_pattern1_instance_t *pinst, client_name_t cname)
 {
     gx_device_pattern_accum *adev =
 	gs_alloc_struct(mem, gx_device_pattern_accum,
@@ -152,6 +153,8 @@
 		   mem, true);
     check_device_separable((gx_device *)adev);
     gx_device_forward_fill_in_procs((gx_device_forward *)adev);
+    adev->instance = pinst;
+    adev->bitmap_memory = stoarge_memory;
     return adev;
 }
 
@@ -638,12 +641,10 @@
      * Note that adev is an internal device, so it will be freed when the
      * last reference to it from a graphics state is deleted.
      */
-    adev = gx_pattern_accum_alloc(mem, "gx_pattern_load");
+    adev = gx_pattern_accum_alloc(mem, mem, pinst, "gx_pattern_load");
     if (adev == 0)
 	return_error(gs_error_VMerror);
     gx_device_set_target((gx_device_forward *)adev, dev);
-    adev->instance = pinst;
-    adev->bitmap_memory = mem;
     code = dev_proc(adev, open_device)((gx_device *)adev);
     if (code < 0)
 	goto fail;

Modified: trunk/gs/src/gxpcolor.h
===================================================================
--- trunk/gs/src/gxpcolor.h	2007-04-10 06:54:36 UTC (rev 7839)
+++ trunk/gs/src/gxpcolor.h	2007-04-10 17:13:41 UTC (rev 7840)
@@ -215,7 +215,9 @@
     instance, bits, mask)
 
 /* Allocate a pattern accumulator. */
-gx_device_pattern_accum *gx_pattern_accum_alloc(gs_memory_t * memory, client_name_t);
+gx_device_pattern_accum * gx_pattern_accum_alloc(gs_memory_t * mem, 
+		       gs_memory_t * stoarge_memory, 
+		       gs_pattern1_instance_t *pinst, client_name_t cname);
 
 /* Add an accumulated pattern to the cache. */
 /* Note that this does not free any of the data in the accumulator */

Modified: trunk/gs/src/zpcolor.c
===================================================================
--- trunk/gs/src/zpcolor.c	2007-04-10 06:54:36 UTC (rev 7839)
+++ trunk/gs/src/zpcolor.c	2007-04-10 17:13:41 UTC (rev 7840)
@@ -250,11 +250,11 @@
 	internal_accum = (code == 0);
     }
     if (internal_accum) {
-	pdev = gx_pattern_accum_alloc(imemory, "pattern_paint_prepare");
+	gs_memory_t *storage_memory = gstate_pattern_cache(pgs)->memory;
+
+	pdev = gx_pattern_accum_alloc(imemory, storage_memory, pinst, "pattern_paint_prepare");
 	if (pdev == 0)
 	    return_error(e_VMerror);
-	pdev->instance = pinst;
-	pdev->bitmap_memory = gstate_pattern_cache(pgs)->memory;
 	code = (*dev_proc(pdev, open_device)) ((gx_device *) pdev);
 	if (code < 0) {
 	    ifree_object(pdev, "pattern_paint_prepare");



More information about the gs-cvs mailing list