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

leonardo at ghostscript.com leonardo at ghostscript.com
Tue Jun 5 14:28:32 PDT 2007


Author: leonardo
Date: 2007-06-05 14:28:32 -0700 (Tue, 05 Jun 2007)
New Revision: 8021

Modified:
   trunk/gs/src/gscolor3.c
   trunk/gs/src/gsptype2.c
   trunk/gs/src/gsptype2.h
   trunk/gs/src/gsshade.c
   trunk/gs/src/gsshade.h
Log:
Fix (shadings) : Optimize path manipulations for shading fill (continued 3).

DETAILS :

This patch finaly removes gs_shading_fill_path and its relatives.
Also gx_dc_shading_path_add_box is now private.
This change is algorithmically equivalent.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gscolor3.c
===================================================================
--- trunk/gs/src/gscolor3.c	2007-06-05 21:10:17 UTC (rev 8020)
+++ trunk/gs/src/gscolor3.c	2007-06-05 21:28:32 UTC (rev 8021)
@@ -52,10 +52,7 @@
      * shfill is equivalent to filling the current clipping path (or, if
      * clipping, its bounding box) with the shading, disregarding the
      * Background if any.  In order to produce reasonable high-level output,
-     * we must actually implement this by calling gs_fill rather than
-     * gs_shading_fill_path.  However, filling with a shading pattern does
-     * paint the Background, so if necessary, we construct a copy of the
-     * shading with Background removed.
+     * we must implement this by calling gs_fill_path. 
      */
     gs_pattern2_template_t pat;
     gs_matrix imat;
@@ -65,7 +62,7 @@
     int code;
 
     /* Must install the shading color space
-       tyo allow check_DeviceN_component_names initialize
+       to allow check_DeviceN_component_names initialize
        the color component map.
      */
     /* Don't bother with saving the old color space, color,

Modified: trunk/gs/src/gsptype2.c
===================================================================
--- trunk/gs/src/gsptype2.c	2007-06-05 21:10:17 UTC (rev 8020)
+++ trunk/gs/src/gsptype2.c	2007-06-05 21:28:32 UTC (rev 8021)
@@ -204,19 +204,6 @@
     return code;
 }
 
-/* Fill path or rect, and with a PatternType 2 color. */
-int
-gx_dc_pattern2_fill_path(const gx_device_color * pdevc, 
-                              gx_path * ppath, gs_fixed_rect * rect, 
-                              gx_device * dev)
-{
-    gs_pattern2_instance_t *pinst =
-        (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
-
-    return gs_shading_fill_path_adjusted(pinst->template.Shading, ppath, rect, dev,
-                                (gs_imager_state *)pinst->saved, !pinst->shfill);
-}
-
 /* Fill a rectangle with a PatternType 2 color. */
 /* WARNING: This function doesn't account the shading BBox
    to allow the clipent to optimize the clipping 
@@ -320,7 +307,7 @@
 }
 
 /* Create a path from a PatternType 2 shading BBox to a path. */
-int
+private int
 gx_dc_shading_path_add_box(gx_path *ppath, const gx_device_color * pdevc)
 {
     gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;

Modified: trunk/gs/src/gsptype2.h
===================================================================
--- trunk/gs/src/gsptype2.h	2007-06-05 21:10:17 UTC (rev 8020)
+++ trunk/gs/src/gsptype2.h	2007-06-05 21:28:32 UTC (rev 8021)
@@ -97,11 +97,6 @@
 /* Check device color for Pattern Type 2. */
 bool gx_dc_is_pattern2_color(const gx_device_color *pdevc);
 
-/* Fill path or rect, and with a PatternType 2 color. */
-int gx_dc_pattern2_fill_path(const gx_device_color * pdevc, 
-			      gx_path * ppath, gs_fixed_rect * rect, 
-			      gx_device * dev);
-
 /* Set the 'shfill' flag to a PatternType 2 pattern instance. */
 int gs_pattern2_set_shfill(gs_client_color * pcc);
 
@@ -119,11 +114,6 @@
 int gx_dc_pattern2_clip_with_bbox(const gx_device_color * pdevc, gx_device * pdev, 
 				  gx_clip_path *cpath_local, const gx_clip_path **cpath1);
 
-
-/* Create a path from a PatternType 2 shading BBox to a path. */
-int gx_dc_shading_path_add_box(gx_path *ppath, const gx_device_color * pdevc);
-
-
 /* Get a shading color space. */
 const gs_color_space *gx_dc_pattern2_get_color_space(const gx_device_color * pdevc);
 

Modified: trunk/gs/src/gsshade.c
===================================================================
--- trunk/gs/src/gsshade.c	2007-06-05 21:10:17 UTC (rev 8020)
+++ trunk/gs/src/gsshade.c	2007-06-05 21:28:32 UTC (rev 8021)
@@ -478,140 +478,3 @@
     }
     return code;
 }
-
-/* Fill a path with a shading. */
-/* Depricated. To be removed soon. */
-private int
-gs_shading_fill_path(const gs_shading_t *psh, /*const*/ gx_path *ppath,
-		     const gs_fixed_rect *prect, gx_device *orig_dev,
-		     gs_imager_state *pis, bool fill_background)
-{   gs_memory_t *mem = pis->memory;
-    const gs_matrix_fixed *pmat = &pis->ctm;
-    gx_device *dev = orig_dev;
-    gs_fixed_rect path_box;
-    gs_rect rect;
-    gx_clip_path *path_clip = 0;
-    bool path_clip_set = false;
-    gx_device_clip path_dev;
-    int code = 0;
-
-    if ((*dev_proc(dev, pattern_manage))(dev, 
-			gs_no_id, NULL, pattern_manage__shading_area) == 0) {
-	path_clip = gx_cpath_alloc(mem, "shading_fill_path(path_clip)");
-	if (path_clip == 0) {
-	    code = gs_note_error(gs_error_VMerror);
-	    goto out;
-	}
-	dev_proc(dev, get_clipping_box)(dev, &path_box);
-	if (prect)
-	    rect_intersect(path_box, *prect);
-	if (psh->params.have_BBox) {
-	    gs_fixed_rect bbox_fixed;
-
-	    if ((is_xxyy(pmat) || is_xyyx(pmat)) &&
-		(code = gx_dc_pattern2_shade_bbox_transform2fixed(&psh->params.BBox, pis,
-						&bbox_fixed)) >= 0
-		) {
-		/* We can fold BBox into the clipping rectangle. */
-		rect_intersect(path_box, bbox_fixed);
-	    } else
-		{
-		gx_path *box_path;
-
-		if (path_box.p.x >= path_box.q.x || path_box.p.y >= path_box.q.y)
-		    goto out;		/* empty rectangle */
-		box_path = gx_path_alloc(mem, "shading_fill_path(box_path)");
-		if (box_path == 0) {
-		    code = gs_note_error(gs_error_VMerror);
-		    goto out;
-		}
-		code = gx_cpath_from_rectangle(path_clip, &path_box);
-		if (code >= 0) {
-		    code = gs_shading_path_add_box(box_path, &psh->params.BBox, pmat);
-		    if (code == gs_error_limitcheck) {
-			/* Ignore huge BBox - bug 689027. */
-			code = 0;
-		    } else if (code >= 0) {
-			code = gx_cpath_intersect(path_clip, box_path,
-					    gx_rule_winding_number, pis);
-			if (code >= 0)
-			    path_clip_set = true;
-		    }
-		}
-		gx_path_free(box_path, "shading_fill_path(box_path)");
-		if (code < 0)
-		    goto out;
-	    }
-	}
-	if (!path_clip_set) {
-	    if (path_box.p.x >= path_box.q.x || path_box.p.y >= path_box.q.y)
-		goto out;		/* empty rectangle */
-	    if ((code = gx_cpath_from_rectangle(path_clip, &path_box)) < 0)
-		goto out;
-	}
-	if (ppath &&
-	    (code =
-	    gx_cpath_intersect(path_clip, ppath, gx_rule_winding_number, pis)) < 0
-	    )
-	    goto out;
-	/* detect empty clip box result and skip filling */
-	if ((path_clip->path.bbox.p.x == path_clip->path.bbox.q.x) || 
-	    (path_clip->path.bbox.p.y == path_clip->path.bbox.q.y))
-	    goto out;
-	gx_make_clip_device(&path_dev, &path_clip->rect_list->list);
-	path_dev.target = dev;
-	path_dev.HWResolution[0] = dev->HWResolution[0];
-	path_dev.HWResolution[1] = dev->HWResolution[1];
-	dev = (gx_device *)&path_dev;
-	dev_proc(dev, open_device)(dev);
-    }
-#if 0 /* doesn't work for 478-01.ps, which sets a big smoothness :
-         makes an assymmetrix domain, and the patch decomposition
-	 becomes highly irregular. */
-    {	gs_fixed_rect r;
-
-	dev_proc(dev, get_clipping_box)(dev, &r);
-	rect_intersect(path_box, r);
-    }
-#else
-    dev_proc(dev, get_clipping_box)(dev, &path_box);
-#endif
-    if (psh->params.Background && fill_background) {
-	const gs_color_space *pcs = psh->params.ColorSpace;
-	gs_client_color cc;
-	gx_device_color dev_color;
-
-	cc = *psh->params.Background;
-	(*pcs->type->restrict_color)(&cc, pcs);
-	(*pcs->type->remap_color)(&cc, pcs, &dev_color, pis,
-				  dev, gs_color_select_texture);
-
-	/****** WRONG IF NON-IDEMPOTENT RasterOp ******/
-	code = gx_shade_background(dev, &path_box, &dev_color, pis->log_op);
-	if (code < 0)
-	    goto out;
-    }
-    {
-	gs_rect path_rect;
-
-	path_rect.p.x = fixed2float(path_box.p.x);
-	path_rect.p.y = fixed2float(path_box.p.y);
-	path_rect.q.x = fixed2float(path_box.q.x);
-	path_rect.q.y = fixed2float(path_box.q.y);
-	gs_bbox_transform_inverse(&path_rect, (const gs_matrix *)pmat, &rect);
-    }
-    code = gs_shading_fill_rectangle(psh, &rect, &path_box, dev, pis);
-out:
-    if (path_clip)
-	gx_cpath_free(path_clip, "shading_fill_path(path_clip)");
-    return code;
-}
-
-int
-gs_shading_fill_path_adjusted(const gs_shading_t *psh, /*const*/ gx_path *ppath,
-		     const gs_fixed_rect *prect, gx_device *orig_dev,
-		     gs_imager_state *pis, bool fill_background)
-{   
-    return  gs_shading_fill_path(psh, ppath, prect, orig_dev, pis, fill_background);
-}
-

Modified: trunk/gs/src/gsshade.h
===================================================================
--- trunk/gs/src/gsshade.h	2007-06-05 21:10:17 UTC (rev 8020)
+++ trunk/gs/src/gsshade.h	2007-06-05 21:28:32 UTC (rev 8021)
@@ -257,17 +257,12 @@
 #define gs_matrix_fixed_DEFINED
 typedef struct gs_matrix_fixed_s gs_matrix_fixed;
 #endif
-/* Fill a path with a shading. */
-/* Depricated. To be removed soon. */
-int gs_shading_fill_path_adjusted(const gs_shading_t *psh, /*const*/ gx_path *ppath,
-			 const gs_fixed_rect *prect, gx_device *dev,
-			 gs_imager_state *pis, bool fill_background);
-
-/* Fill a path with a shading. */
+/* Fill a rectangle with a shading. */
 int gs_shading_do_fill_rectangle(const gs_shading_t *psh, 
 			 const gs_fixed_rect *prect, gx_device *dev,
 			 gs_imager_state *pis, bool fill_background);
 
+/* Add a shading bbox to a path. */
 int gs_shading_path_add_box(gx_path *ppath, const gs_rect *pbox,
 		     const gs_matrix_fixed *pmat);
 



More information about the gs-cvs mailing list