Bug 689732

Summary: The pxlmono device always falls back to writing uncompressed bitmaps
Product: Ghostscript Reporter: Marcos H. Woehrmann <marcos.woehrmann>
Component: Other DriverAssignee: Marcos H. Woehrmann <marcos.woehrmann>
Status: NOTIFIED FIXED    
Severity: normal    
Priority: P4    
Version: master   
Hardware: PC   
OS: Linux   
Customer: Word Size: ---

Description Marcos H. Woehrmann 2008-03-02 19:24:42 UTC
There may be a problem in pclxl_write_image_data() since it never compresses the
data, the s_RLE_template.process call fails and the code reverts to writing
uncompressed data.
Comment 1 Marcos H. Woehrmann 2008-03-02 20:04:05 UTC
After much tracing of srle.c and gdevpx.c I believe this bug is in 
the portion of s_RLE_process() that looks ahead in order to be able
to optimally compress the data.  Rather than attempting to modify the
function and probably breaking something else I'm taking the 99% solution
and just calling s_RLE_process with last set to true instead of false.
This disables the look ahead feature, presumably making the compression
very slightly suboptimal but at least now it works.

This change results in pxl files that are significantly smaller than before
(i.e. the test file associated with bug 689595 is reduced in size from 1.1 megs
to 387k). 

===================================================================
--- gdevpx.c    (revision 8578)
+++ gdevpx.c    (working copy)
@@ -514,14 +514,14 @@
            r.ptr = data + i * raster - 1;
            r.limit = r.ptr + width_bytes;
            if ((*s_RLE_template.process)
-               ((stream_state *) & rlstate, &r, &w, false) != 0 ||
+               ((stream_state *) & rlstate, &r, &w, true) != 0 ||
                r.ptr != r.limit
                )
                goto ncfree;
            r.ptr = (const byte *)"\000\000\000\000\000";
            r.limit = r.ptr + (-(int)width_bytes & 3);
            if ((*s_RLE_template.process)
-               ((stream_state *) & rlstate, &r, &w, false) != 0 ||
+               ((stream_state *) & rlstate, &r, &w, true) != 0 ||
                r.ptr != r.limit
                )

Commited as r8579.