As the device is already finished, we can not lock it without raising an
error, so we have to open code the destruction of the font entries.
Fortunately we can make several simplifying assumptions about the
required cleanup as we know the device is also being destroyed.
We also need to acquire the device upon finish, similar surface creation
and the pagination functions, i.e. the other times outside of the
drawing ops that must modify the shared context/device.
As _cairo_clip_init_rectangle() is equivalent and more importantly more
clearly written as:
_cairo_clip_init(&clip);
if (status = _cairo_clip_rectangle(&clip, &rect)) {
_cairo_clip_fini(&fini);
return status;
}
perform the transformation and in the process catch a few mistakes along
error paths.
Damien Carbonne reported that cairo_device_t lacked the language binding
hooks normally associated with cairo objects. So add the missing
get_reference_count, get_user_data and set_user_data.
A fallback should never persist beyond the flush into the finish, but
yet one remains in test/clip-shapes-unaligned-rectangles. For the time
been, simply clean up the rogue surface.
During finish, if we encountered an error during the construction of the
surface, simply proceed to cleanup rather than emit the incomplete and
potentially subtly broken output.
In the event of an empty bounded rectangle, the computation of the
unbounded - bounded rectangles leads to negative areas, integer overflow
and death.
[And similarly for the derived surfaces.]
Ensure that the error status from patterns is propagated when used by
doing so in the surface layer. Similarly check that a surface pattern
has not been finished.
In the simplest case of pass-through glyphs we made a mistake in
propagating the number of glyphs.
Reported-by: Christophe de Dinechin <christophe@taodyne.com>
Long ago when converting the pixel shader structs into macros and
reducing the code size by ~100k (the inlines were too depth for constant
propagation and CSE), I broke the encoding of negated channels. So
instead use a single bit to indicate a negation rather than 2s
complement (with sign extension into neighbouring channels, oops). The
disadvantage is that expressing the negated channel is a little more
ugly.