Bug 688970

Summary: (shadings) Optimize filling a path with a shading color
Product: Ghostscript Reporter: leonardo <leonardo>
Component: Graphics LibraryAssignee: leonardo <leonardo>
Status: NOTIFIED FIXED    
Severity: normal    
Priority: P2    
Version: master   
Hardware: PC   
OS: Windows XP   
Customer: Word Size: ---

Description leonardo 2006-11-01 22:33:07 UTC
When filling a path with a shading color, the path is being intersected with 
the clipping path in gx_default_fill_path, then converts into a (big) path, 
then intersect with the shading BBox and with the path's bbox in 
gs_shading_fill_path. A better way is to account the shading BBox in 
gx_default_fill_path, and then execute a part of gs_shading_fill_path except 
its clipping part.

We already tried a similar optimization, but we got an unexpected raster 
difference - the coverage area become smallar in a part of pixel. Probably 
fill_adjust was not properly accounted when compute a clipping.
Comment 1 leonardo 2006-11-01 22:35:42 UTC
Another related patch is 
http://ghostscript.com/pipermail/gs-cvs/2006-November/006911.html
Strongly speaking, it is not related to imagemask, but to filling a path. We 
mention it here because it affects same test document.
Comment 2 leonardo 2006-11-01 22:36:16 UTC
Please disregard the last comment. It is unintentionally misplaced.
Comment 3 leonardo 2006-11-01 23:30:29 UTC
The test case is 09-47L.
Comment 4 leonardo 2007-05-21 01:25:39 UTC
Bumping the priority sinse it's a part of the current project.
Comment 5 leonardo 2007-10-10 11:54:51 UTC
The bug description is some obsolete. gs_shading_fill_path is not relevant now. 
Both intersections are now done in gx_default_fill_path (the second one - with 
calling gx_dc_pattern2_clip_with_bbox).

But exchanging the order of intersections still would be useful. So the wanted 
change is local to gx_default_fill_path. Should first intersect pcpath or rect 
with shading bbox, then with path (if the latter is not NULL).
Comment 6 leonardo 2008-01-28 15:08:11 UTC
Patch to HEAD :
http://ghostscript.com/pipermail/gs-cvs/2008-January/008093.html

It closes the problem but the code needs some cleanup - see the explanation is 
the log message. Keeping the bug open until the cleanup is done.