[gs-cvs] rev 8513 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Tue Jan 29 09:02:51 PST 2008
Author: leonardo
Date: 2008-01-29 09:02:50 -0800 (Tue, 29 Jan 2008)
New Revision: 8513
Modified:
trunk/gs/src/gsptype2.c
trunk/gs/src/gsptype2.h
trunk/gs/src/gxfill.c
trunk/gs/src/gximask.c
Log:
Fix (graphics) : Optimize filling a path with a shading color (continued 2).
DETAILS :
Bug 688970 "(shadings) Optimize filling a path with a shading color".
A minor code cleanup : Removing code portions that became unused.
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gsptype2.c
===================================================================
--- trunk/gs/src/gsptype2.c 2008-01-29 12:41:42 UTC (rev 8512)
+++ trunk/gs/src/gsptype2.c 2008-01-29 17:02:50 UTC (rev 8513)
@@ -325,35 +325,6 @@
/* Intersect a clipping path a shading BBox. */
int
-gx_dc_pattern2_clip_with_bbox(const gx_device_color * pdevc, gx_device * pdev,
- gx_clip_path *cpath_local, const gx_clip_path **ppcpath1)
-{
- if (gx_dc_is_pattern2_color(pdevc) && gx_dc_pattern2_color_has_bbox(pdevc) &&
- (*dev_proc(pdev, pattern_manage))(pdev, gs_no_id, NULL, pattern_manage__shading_area) == 0) {
- gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern;
- gx_path box_path;
- gs_memory_t *mem = (*ppcpath1 != NULL ? (*ppcpath1)->path.memory : pdev->memory);
- int code;
-
- gx_path_init_local(&box_path, mem);
- code = gx_dc_shading_path_add_box(&box_path, pdevc);
- if (code == gs_error_limitcheck) {
- /* Ignore huge BBox - bug 689027. */
- code = 0;
- } else {
- if (code >= 0) {
- gx_cpath_init_local_shared(cpath_local, *ppcpath1, mem);
- code = gx_cpath_intersect(cpath_local, &box_path, gx_rule_winding_number, (gs_imager_state *)pinst->saved);
- *ppcpath1 = cpath_local;
- }
- }
- gx_path_free(&box_path, "gx_default_fill_path(path_bbox)");
- }
- return 0;
-}
-
-#if !SHADING_INTERSECT_CPATH_WITH_PATH_FIRST
-int
gx_dc_pattern2_clip_with_bbox_simple(const gx_device_color * pdevc, gx_device * pdev,
gx_clip_path *cpath_local)
{
@@ -377,6 +348,7 @@
}
return code;
}
+
/* Check whether color is a shading with BBox. */
int
gx_dc_pattern2_is_rectangular_cell(const gx_device_color * pdevc, gx_device * pdev, gs_fixed_rect *rect)
@@ -411,7 +383,6 @@
return 0;
}
-#endif
/* Get a shading color space. */
const gs_color_space *
Modified: trunk/gs/src/gsptype2.h
===================================================================
--- trunk/gs/src/gsptype2.h 2008-01-29 12:41:42 UTC (rev 8512)
+++ trunk/gs/src/gsptype2.h 2008-01-29 17:02:50 UTC (rev 8513)
@@ -110,17 +110,11 @@
/* Checks whether a PatternType 2 has a shading BBox. */
int gx_dc_pattern2_color_has_bbox(const gx_device_color * pdevc);
-#define SHADING_INTERSECT_CPATH_WITH_PATH_FIRST 0
-
/* Intersect a clipping path a shading BBox. */
-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);
-#if !SHADING_INTERSECT_CPATH_WITH_PATH_FIRST
int gx_dc_pattern2_clip_with_bbox_simple(const gx_device_color * pdevc, gx_device * pdev,
gx_clip_path *cpath);
/* Check whether color is a shading with BBox. */
int gx_dc_pattern2_is_rectangular_cell(const gx_device_color * pdevc, gx_device * pdev, gs_fixed_rect *rect);
-#endif
/* Get a shading color space. */
const gs_color_space *gx_dc_pattern2_get_color_space(const gx_device_color * pdevc);
Modified: trunk/gs/src/gxfill.c
===================================================================
--- trunk/gs/src/gxfill.c 2008-01-29 12:41:42 UTC (rev 8512)
+++ trunk/gs/src/gxfill.c 2008-01-29 17:02:50 UTC (rev 8513)
@@ -600,32 +600,7 @@
*/
gs_imager_state *pis_noconst = (gs_imager_state *)pis; /* Break const. */
-# if SHADING_INTERSECT_CPATH_WITH_PATH_FIRST
- const gx_clip_path *pcpath1, *pcpath2;
- gx_clip_path cpath_intersection, cpath_with_shading_bbox;
-
- if (ppath != NULL) {
- code = gx_cpath_init_local_shared(&cpath_intersection, pcpath, pdev->memory);
- if (code < 0)
- return code;
- if (pcpath == NULL) {
- gs_fixed_rect clip_box1;
-
- (*dev_proc(pdev, get_clipping_box)) (pdev, &clip_box1);
- code = gx_cpath_from_rectangle(&cpath_intersection, &clip_box1);
- }
- if (code >= 0)
- code = gx_cpath_intersect_with_params(&cpath_intersection, ppath, params->rule,
- pis_noconst, params);
- pcpath1 = &cpath_intersection;
- } else
- pcpath1 = pcpath;
- pcpath2 = pcpath1;
- if (code >= 0)
- code = gx_dc_pattern2_clip_with_bbox(pdevc, pdev, &cpath_with_shading_bbox, &pcpath1);
-# else
gx_clip_path cpath_intersection;
- gx_clip_path *pcpath1 = &cpath_intersection;
const gs_fixed_rect *pcbox = (pcpath == NULL ? NULL : cpath_is_rectangle(pcpath));
gs_fixed_rect shading_rect;
int shading_rect_code = gx_dc_pattern2_is_rectangular_cell(pdevc, pdev, &shading_rect);
@@ -656,7 +631,6 @@
if (ppath != NULL && code >= 0)
code = gx_cpath_intersect_with_params(&cpath_intersection, ppath, params->rule,
pis_noconst, params);
-# endif
/* Do fill : */
if (code >= 0) {
gs_fixed_rect clip_box;
@@ -665,7 +639,7 @@
gx_device *dev;
gx_device_clip cdev;
- gx_cpath_outer_box(pcpath1, &clip_box);
+ gx_cpath_outer_box(&cpath_intersection, &clip_box);
cb.p.x = fixed2int_pixround(clip_box.p.x);
cb.p.y = fixed2int_pixround(clip_box.p.y);
cb.q.x = fixed2int_pixround(clip_box.q.x);
@@ -675,10 +649,10 @@
/* A special interaction with clist writer device :
pass the intersected clipping path. It uses an unusual call to
fill_path with NULL device color. */
- code = (*dev_proc(pdev, fill_path))(pdev, pis, ppath, params, NULL, pcpath1);
+ code = (*dev_proc(pdev, fill_path))(pdev, pis, ppath, params, NULL, &cpath_intersection);
dev = pdev;
} else {
- gx_make_clip_device_on_stack(&cdev, pcpath1, pdev);
+ gx_make_clip_device_on_stack(&cdev, &cpath_intersection, pdev);
dev = (gx_device *)&cdev;
if ((*dev_proc(pdev, pattern_manage))(pdev,
gs_no_id, NULL, pattern_manage__shading_area) > 0)
@@ -690,14 +664,7 @@
cb.p.x, cb.p.y, cb.q.x - cb.p.x, cb.q.y - cb.p.y,
dev, pis->log_op, rs);
}
-# if SHADING_INTERSECT_CPATH_WITH_PATH_FIRST
- if (ppath != NULL)
- gx_cpath_free(&cpath_intersection, "shading_fill_cpath_intersection");
- if (pcpath1 != pcpath2)
- gx_cpath_free(&cpath_with_shading_bbox, "shading_fill_cpath_intersection");
-# else
gx_cpath_free(&cpath_intersection, "shading_fill_cpath_intersection");
-# endif
} else {
bool got_dc = false;
vd_save;
Modified: trunk/gs/src/gximask.c
===================================================================
--- trunk/gs/src/gximask.c 2008-01-29 12:41:42 UTC (rev 8512)
+++ trunk/gs/src/gximask.c 2008-01-29 17:02:50 UTC (rev 8513)
@@ -61,23 +61,14 @@
{
gx_device_cpath_accum *pcdev = (gx_device_cpath_accum *)dev;
gx_clip_path cpath;
-# if SHADING_INTERSECT_CPATH_WITH_PATH_FIRST
- gx_clip_path cpath_with_shading_bbox;
- const gx_clip_path *pcpath1 = &cpath;
-# endif
gx_device_clip cdev;
int code, code1;
gx_cpath_init_local(&cpath, pcdev->memory);
code = gx_cpath_accum_end(pcdev, &cpath);
if (code >= 0)
-# if SHADING_INTERSECT_CPATH_WITH_PATH_FIRST
- code = gx_dc_pattern2_clip_with_bbox(pdevc, tdev, &cpath_with_shading_bbox, &pcpath1);
- gx_make_clip_device_on_stack(&cdev, pcpath1, tdev);
-# else
code = gx_dc_pattern2_clip_with_bbox_simple(pdevc, tdev, &cpath);
gx_make_clip_device_on_stack(&cdev, &cpath, tdev);
-# endif
if (code >= 0) {
code1 = gx_device_color_fill_rectangle(pdevc,
pcdev->bbox.p.x, pcdev->bbox.p.y,
@@ -88,10 +79,6 @@
code = code1;
gx_device_retain((gx_device *)pcdev, false);
}
-# if SHADING_INTERSECT_CPATH_WITH_PATH_FIRST
- if (pcpath1 == &cpath_with_shading_bbox)
- gx_cpath_free(&cpath_with_shading_bbox, "s_image_cleanup");
-# endif
gx_cpath_free(&cpath, "s_image_cleanup");
return code;
}
More information about the gs-cvs
mailing list