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

leonardo at ghostscript.com leonardo at ghostscript.com
Thu Nov 29 13:39:54 PST 2007


Author: leonardo
Date: 2007-11-29 13:39:53 -0800 (Thu, 29 Nov 2007)
New Revision: 8416

Modified:
   trunk/gs/src/gdevp14.c
   trunk/gs/src/gxclpath.c
   trunk/gs/src/gxclrect.c
Log:
Fix (shadings) : Optimize path manipulations for shading fill (continued).

DETAILS :

Debugged with the test case of the bug 689155.

A long ago the graphics library converted the sfill clipping into a path.
It was improved with revision 8017 with introducing 
a device response for pattern_manage__shfill_doesnt_need_path.
However the revision 8017 appears incomplete : 
it missed the related change to the clist writer device
and to pdf14 device. This patch fixes it.

This patch causes a progression for the problem
known as bug 689338 "Raster depends on bands".
With banded rendering some shadings are now painted some wider,
and the raster appears equal to one from unbanded rendering.
It happens because the old code doesn't convert shfill clipping
into a path when no banding, and does convert when banding.
The new code does not convert in both cases.

EXPECTED DIFFERENCES :
      
Progression : a banded raster is closer to unbanded :

300dpi banded :
gradmesh.ai
S2_Digitalproof-Forum_x3k.pdf
SmoothShading.pdf

72dpi banded :
shading_prob_800.ps
Bug688631.pdf


Modified: trunk/gs/src/gdevp14.c
===================================================================
--- trunk/gs/src/gdevp14.c	2007-11-29 01:42:16 UTC (rev 8415)
+++ trunk/gs/src/gdevp14.c	2007-11-29 21:39:53 UTC (rev 8416)
@@ -227,7 +227,7 @@
 static	dev_proc_fill_rectangle(pdf14_mark_fill_rectangle);
 static	dev_proc_fill_rectangle(pdf14_mark_fill_rectangle_ko_simple);
 static	dev_proc_fill_path(pdf14_fill_path);
-static dev_proc_copy_mono(pdf14_copy_mono);
+static  dev_proc_copy_mono(pdf14_copy_mono);
 static	dev_proc_stroke_path(pdf14_stroke_path);
 static	dev_proc_begin_typed_image(pdf14_begin_typed_image);
 static	dev_proc_text_begin(pdf14_text_begin);
@@ -237,6 +237,7 @@
 static	dev_proc_end_transparency_group(pdf14_end_transparency_group);
 static	dev_proc_begin_transparency_mask(pdf14_begin_transparency_mask);
 static	dev_proc_end_transparency_mask(pdf14_end_transparency_mask);
+static  dev_proc_pattern_manage(pdf14_pattern_manage);
 static int pdf14_clist_get_param_compressed_color_list(pdf14_device * p14dev);
 
 static	const gx_color_map_procs *
@@ -302,7 +303,7 @@
 	get_color_comp_index,		/* get_color_comp_index */\
 	encode_color,			/* encode_color */\
 	decode_color,			/* decode_color */\
-	NULL,				/* pattern_manage */\
+	pdf14_pattern_manage,		/* pattern_manage */\
 	NULL,				/* fill_rectangle_hl_color */\
 	NULL,				/* include_color_space */\
 	NULL,				/* fill_linear_color_scanline */\
@@ -2685,6 +2686,14 @@
     return &pdf14_cmap_many;
 }
 
+static int 
+pdf14_pattern_manage(gx_device *pdev, gx_bitmap_id id,
+		gs_pattern1_instance_t *pinst, pattern_manage_t function)
+{
+    if (function == pattern_manage__shfill_doesnt_need_path)
+	return 1;
+    return gx_default_pattern_manage(pdev, id, pinst, function);
+}
 
 int
 gs_pdf14_device_push(gs_memory_t *mem, gs_imager_state * pis,
@@ -3164,7 +3173,7 @@
 	get_color_comp_index,		/* get_color_comp_index */\
 	encode_color,			/* encode_color */\
 	decode_color,			/* decode_color */\
-	NULL,				/* pattern_manage */\
+	clist_pattern_manage,	/* pattern_manage */\
 	NULL,				/* fill_rectangle_hl_color */\
 	NULL,				/* include_color_space */\
 	NULL,				/* fill_linear_color_scanline */\

Modified: trunk/gs/src/gxclpath.c
===================================================================
--- trunk/gs/src/gxclpath.c	2007-11-29 01:42:16 UTC (rev 8415)
+++ trunk/gs/src/gxclpath.c	2007-11-29 21:39:53 UTC (rev 8416)
@@ -604,7 +604,12 @@
     {
 	gs_fixed_rect bbox;
 
-	gx_path_bbox(ppath, &bbox);
+	if (ppath != NULL)
+	    gx_path_bbox(ppath, &bbox);
+	else {
+	    /* gx_default_fill_path passes the clip path for shfill. */
+	    gx_cpath_outer_box(pcpath, &bbox);
+	}
 	ry = fixed2int(bbox.p.y) - 1;
 	rheight = fixed2int_ceiling(bbox.q.y) - ry + 1;
 	fit_fill_y(dev, ry, rheight);

Modified: trunk/gs/src/gxclrect.c
===================================================================
--- trunk/gs/src/gxclrect.c	2007-11-29 01:42:16 UTC (rev 8415)
+++ trunk/gs/src/gxclrect.c	2007-11-29 21:39:53 UTC (rev 8416)
@@ -436,6 +436,8 @@
 {
     if (function == pattern_manage__handles_clip_path)
 	return 1;
+    if (function == pattern_manage__shfill_doesnt_need_path)
+	return 1;
     return gx_default_pattern_manage(pdev, id, pinst, function);
 }
 



More information about the gs-cvs mailing list