[gs-cvs] rev 8880 - trunk/gs/lib
leonardo at ghostscript.com
leonardo at ghostscript.com
Sun Jul 27 02:29:38 PDT 2008
Author: leonardo
Date: 2008-07-27 02:29:37 -0700 (Sun, 27 Jul 2008)
New Revision: 8880
Modified:
trunk/gs/lib/pdf_draw.ps
Log:
Fix (PDF interpreter) : A temporary work around huge images with a soft mask.
DETAILS :
Bug 689080 "PDF Crash with Transparency at 2880 dpi".
This is a temporary workaraound for the problem,
see comment in code.
With this patch the test case doesn't crash,
but it needs -dBufferSpace=500000000 to complete in 15 minutes
on Core 2 Duo 2.4 MHz with debug build.
The test case is pretty big anyway - it generates a 4.2 gigapixel raster.
Thankls to Ray for obtaining the buffer space from a device.
I think the old code is incorrect because it looks applying the
mask two times : first when installing a mask buffer with
.begintransparencymaskimage in doimagesmask, and second time when
processing a Type 103 image in C code. The raster difference
is likely caused by that. I don't perform a deeper analyzis,
because it's a temporary fix which needs to be replaced soon.
All that is written in this paragraph are not sure,
because there is no time for a deeper analyzis before 8.63 release.
When we'll complete Type 103 images (with rasterizing after clist
and with a proper handling in pdfwrite), .begintransparencymaskimage
will likely go away.
EXPECTED DIFFERENCES :
Bug689369.pdf (a minor raster difference at the bottom of nthe page).
Modified: trunk/gs/lib/pdf_draw.ps
===================================================================
--- trunk/gs/lib/pdf_draw.ps 2008-07-27 07:03:42 UTC (rev 8879)
+++ trunk/gs/lib/pdf_draw.ps 2008-07-27 09:29:37 UTC (rev 8880)
@@ -1119,10 +1119,37 @@
doimage
} ifelse
} bdef
+
+/is_big_mask { % <mask> is_big_mask <bool>
+ 1 0 dtransform dup mul exch dup mul sqrt add
+ 0 1 dtransform dup mul exch dup mul sqrt add mul
+ currentdevice getdeviceprops .dicttomark /BufferSpace .knownget not {
+ 4000000 % hack: Can't get the real default value from C source.
+ } if
+ 2 % arbitrary
+ div gt
+} bind def
+
/doimage { % <imagemask> doimage -
% imagedict is currentdict, gets popped from dstack
DataSource exch
- PDFusingtransparency {
+
+ PDFusingtransparency
+ currentdevice .devicename /pdfwrite ne {
+ % This is a temporary workaround for the bug 689080,
+ % which is done under a rush of 8.63 release.
+ % The purpose is to disable a conversion of an image with soft mask
+ % into a Type 103 image, which currently allocates a full mask buffer
+ % before writing clist. Note that imagemask installs
+ % the transparency mask anyway (likely another bug),
+ % so the image is still masked.
+ % With this workaround the Matte color is not working (ignored).
+ is_big_mask not
+ } {
+ true % pdfwrite doesn't need the workaround explained above,
+ % and cannot work with it.
+ } ifelse
+ and {
currentdict /SMask knownoget
} {
false
More information about the gs-cvs
mailing list