Add an optimization to cairo-ps-surface.c so that it ignores any
CAIRO_OPERATOR_CLEAR drawing operation that occurs on a blank page.
Also change the test suite to erase with OPERATOR_CLEAR instead of
OPERATOR_SOURCE with an all-0 source pattern.
With this change, 32 of the 61 test cases change from all-fallback to
all-native for the ps backend.
Of these 32 test cases, 13 pass the test suite with the original
reference images. Another 18 cases differ only in the single-pixel
boundary of objects due to cairo vs. ghostscript rasterization
differences. We ignore these by adding new ps-specific reference
images, (included in this commit).
Finally, there appears to be one genuine failure, (dash-caps-joins),
in which the PostScript dashes (at least as rendered by ghostscript)
differ significantly from the cairo-rendered dashes.
This reverts 3b873c66be commit.
It seemed like a good idea at the time, but...
The pngalpha target only gets the fully transparent regions correct.
But we still need to get the partially translucent regions correct.
The pngalpha target doesn't help here---instead we were already
flattening the reference image during testing. And in that case,
having anything other than alpha==1 in the output png doesn't really
help, (and meanwhile it was tripping up the current buffer_diff code).
If clipping occurs before any drawing, then we still need to issue a start page call.
Otherwise, the clip ends up being inverted since the scaling
transformation that puts PostScript into a cairo-oriented coordinate
system only happens in start_page.
This solves the problem with the previous commit that made strings
longer than the "standard" 65k implementation limit for strings.
It's achieved by removing the line-wrapping from the base85 stream and
instead adding a new string-array stream between the base85 stream and
the output stream (the string-array stream does the line wrapping and
enforces the 65k characters per string limit).
This is a baby step toward having shared source patterns in the
PostScript output. This patch is based on original work by Keith
Packard in the following commit:
06b83b89fc
One problem with this approach is that it attempts to put an entire
image into a PostScript string object. However, PostScript strings are
typically limited to 65k bytes. So, as is, this commit causes a few
failures for tests in the suite with large output images.
What was happening here is that some backends (such as the PS surface
backend) directly generate an output file, and then run a conversion
process to generate the png file. Some bugs were such that a broken
file would successfully be generated, the conversion would fail (the
failure was unnoticed), and the test suite would happily verify the
old image from a previously successful run.
This fix eliminates this source of false positives.
The cairo_output_stream_t object already had an internal status value,
but it was annoyingly returning status values from various functions.
It also was missing proper shutdown-on-error as well as nil-create
semantics.
This fixes those shortcomings and adjusts all callers for the new
semantics, (leading to simpler and more correct calling
code---particularly in the case of cairo-base85-stream.c).
Now _cairo_output_stream_create accepts a new close callback, (which
the base85 stream uses to write its trailer). This eliminates the
former kludge used to fclose the stdio output streams, and required a
bit of touchup to the pdf, ps, and svg-surface usage of streams.
Introduce a new pattern_operation_analyze function which allows a much
simpler idiom to be used by all of the drawing operations. This also
provides new assertions that when we are not analyzing we are never
called to perform an operation that we would analyze as
unsupported.
This switches the implementation of _cairo_lzw_compress from using
cairo-hash.c to a custom implementation of the same algorithm that
takes advantage of the specific details of what is needed here.
This final version now has comparable performance to the libtiff code,
but should hopefully be easier to understand.
Add a bunch of comments explaining how the various pieces work.
This new implementation is an entirely original work directly from the
description of the LZWDecode filter in the PostScript Language
Reference, (and in spite of the bugs in the examples provided in that
reference).
This implementation uses the existing cairo-hash.c for the symbol
table. This implementation is somewhat easier to read than the libtiff
code, and avoids any code that may have an advertising clause
attached. This new implementation is the simplest thing I could
implement. It is not as efficient as the libtiff code, (though I did
expect better things from cairo-hash.c).
* src/Makefile.am:
Add cairo-lzw.c to sources
Remove erronous space at start of line
* src/cairo-lzw.c:
New file implementing _cairo_compress_lzw which does Lempel-Ziv & Welch
compression as used by postscript. Based on code from libtiff.
* src/cairo-output-stream.c:
Add _cairo_output_stream_write_base85_string which implements
an encoder for the ASCII85Decode postscript filter.
* src/cairoint.h:
Add _cairo_compress_lzw and _cairo_output_stream_write_base85_string.
* src/cairo-ps-surface.c:
Write Images LZW + Base85 encoded.
Change ps level to 2 (we only needed level 3 for FlateDecode).
Change DocumentData to Clean7Bit as we don't include binary data
anymore.
Surely, the ! instead of ~ here was just a typo. I'd feel better if I
had a failing test case for this though, (time to break out gcov
again).
Fixes bug #6185:
Strange pointer operations in fbCompositeTrans_0888xnx0888 (pixman/src/fbpict.c)
https://bugs.freedesktop.org/show_bug.cgi?id=6185