This closes bug #5816:
Image surfaces do not start out blank by default
https://bugs.freedesktop.org/show_bug.cgi?id=5816
This also fixes all of the test suite failures introduced by moving
the CLEAR on blank page optimization up to the paginated surface from
the PS surface.
These new stubs explicitly return UNSUPPORTED unconditionally. This is
no different than the implicit UNSUPPORTED which the analysis surface
was inferring from NULL for 4 of the functions before.
However, _cairo_pdf_surface_fill was actually trying to draw things,
but without correctly characterizing it during the analysis stage.
This was just an oversight, as the PDF surface was always triggereing
full page fall backs anway due to the initial unsupported paint with
CLEAR.
Now, we explicitly return UNSUPPORTED for all drawing operations so we
get image fallbacks by design and not by accident.
This allows for any surface using the paginated_surface backend to
easily do stuff at the beginning of each page, (such as writing out
any per-page header necessary).
This replaces some of the per-page state tracking that the PS surface
was doing, (though it still has some left for its optimization of
CLEAR on a blank page).
This adds an aactual test_paginated_surface_backend rather than just
having this test surface create a paginated surface around an image
surface. This is a more realistic test of what a paginated surface is
and should be more useful as an example of how to use the paginated
surface, (and in particular the analysis portions).
The extra check makes sure zero length segments are not skipped when computing
the dash start state. This is needed so that we get proper line capping if, for
example, the first dash segment has zero length and we have a dash offset of
zero.
Face computation still works if a line has zero length, all that is needed is a
slope and a point. This patch fixes bug #5561 because the faces are initialized
even if the segment has zero length as expected by
_cairo_stroker_line_to_dashed.
This makes the slope calculation more accurate for dashed lines by computing it
once for the entire line instead for each individual dash segment. It also
adjusts stroker_line_to() to match the new convention for
stroker_add_sub_edge().
This makes line_to_dashed more like line_to by returning immediately on
degenerate paths. This is needed so that we can do the slope calculation for
the entire line.
We teach the output stream to catch a NULL file error here, which
allows for less checking in ps_surface_create. We also fix the ps
surface code to look for the status of a nil stream rather than
checking for NULL.
All other cairo destructors and reference functions accept and ignore NULL,
so fix up cairo_destroy(), cairo_reference(), and cairo_output_stream_destroy()
to do so too.
I discovered that _cairo_hash_table_foreach walks over the hash table
without preventing it from being resized as a result of deletions
occuring from the callback.
Kinda nasty when you're trying to free everything from a hash table.
It was also easy to fix; just prevent the table from being resized while
iterating and clean it up after the iteration is completed.
With the recent fix to the treatment of sub-paths with respect to
dashing, this test is now correct except for slight difference in
ghostscript vs. cairo rasterization. This commit records the
ghostscript output as the new reference image against which the ps
output should be tested.
Fixes the bug mentioned in b87726ee2a by reseting
the dash pattern for each new subpath. This is correct behaviour according to
the end of PDF Reference v1.6 section 4.3.2.
This commit now makes the dash-caps-joins test case pass for all
backends except for the PostScript backend.
We would like to be compatible with PostScript/PDF dash semantics. And
according to the description of the setdash operator in section 8.2 of
the PostScript Language Reference Manual, (as well as the description
of the line dash pattern in section 4.3.2 of the PDF Reference), each
sub-path should be treated independently with respect to dashing.
With this change, this test now fails for most backends for which it
previously passed.