The module gximage3x.c defines a processing of images with soft masks, but this stuff currently is called for small images only. For big images ikt was disabled with rev 8880 as a temporary workaround for the bug 689080 "PDF Crash with Transparency at 2880 dpi". Revision 9027 inmplements a technological option NEW_IMAGE3X for implementing a right algorithm for images with soft mask. Currently, when running with no NEW_IMAGE3X with a raster device, and when the image is big, we first process the mask and then the main image. It can't work when SMaskInData is true. When running with NEW_IMAGE3X, gximage3x.c works, but it causes a huge clist because the latter can't pass images with soft masks, and they are converted into rectangles. So what we need here is to pass image with soft mask through clist.
A disposition for this work is explained in Comment #5 of the bug 689080 (except "Remark" in 8th paragraph, which was committed as the workaround mentioned above). Here is an updated strategy for fixing this problem. 1. Deliver NEW_IMAGE3X to the graphics library. A patch is waiting for Ralph's approval. I'll attach it after ending this comment. 2. When NEW_IMAGE3X is true, the image enumerator creates a device for rasterising the mask. We need to replace it with sending create_transparency_mask to gdevp14. It will either create an auxiliary device for rasterizing the mask, or a device for forwarding the mask data to clist. 3. pass the mask device from gdevp14 back to the image enumerator. The interface of gdevp14 to be extended for that. 4. Implement an additional agrument flag in create_transparency_group, which tells that the mask will be rasterized in p;arallel witrh the group. Here we drop the constraint that the mask buffer is closed before opening a group buffer. It will imply changes to the logic of buffer allocation, freeing and no leaks on errors. 5. Currently image3x.c creates a bbox device to forward the main image rasterization to the target device. This nice hack to be removed, and the compositor created by create_transparency_group must work instead. Maybe we'll still need a forwarding device to comply the finalizations, but the enumerator's closing method should send end_transparency_group to gdevp14. 6. Debug it with no banding. 7. improve clist with passing up to 3 images in parallel : the opacity mask, the shape mask and the main image. Note it will work for image 3, which doesn't work with clist yet. clist writer will install auxiliary devices for handling mask data. 8. when create_transparency_group is being sent to clist writer with external mask, the mask data is not yet created, but will go by a "parallel" flow with the main image. Therefore the new argument is NULL, but we need a flag to designate the case of external mask. The flag to be processed in writer and in reader, and the reader will create an extra mask buffer and an extra device that write to that buffer. 9. debug it with banding. 10. At this point the rasterization will work, but pdfwrite still needs the old implementation. So work on pdfwrite to accept properly data from the new image3x.c . 11. debug pdfwrite. 12. switch to the new code and remove NEW_IMAGE3X from gs/Resource/Init, from gs/psi and from gs/base .
Created attachment 4351 [details] patch1.txt A patch for passing NEW_IMAGE3X flag to the graphics library. It waits for ralph's approval.
This can't be fixed within my ownership. Passing to Henry.
Michael, Ray is this patch still relevant?
Henry, This particular patch is not really relavent since it is just a switch to code that was not written. We still have the issue with large soft mask images not being handled optimally in the clist. Ray and I will need to talk about how best to do this. Michael
SmaskInData has been implemented.