As suggested on the list, this splits the cairo-boilerplate-glitz.c
file in three separate files, one for each backend. Furthermore,
it fixes a few problems in compilation of the AGL backend test harness.
When computing the bounds of the clip path, we care more for a fast result
than absolute precision as the extents are only used as a guide to trim
the future operations. So computing the extents of the path suffices.
_pixman_format_from_masks returns a boolean instead of cairo status code.
Without this fix, get_image bails out over and over again even operations
was completed successfully. :-(
Thanks Nicolas Bruguier for writing the original patch and
thanks Paolo Bonzini for pointing out. This patch converts 24.8
fixed point values into 16.16 ones before passing them down to glitz.
And I fixed a use-after-free issue in _cairo_glitz_surface_set_clip_region.
glitz_surface_set_clip_region takes the pointer and doesn't copy the
clip boxes, the original code frees the clip boxes immediately after
setting clip region. Keeping the box around with the life time of clip
region fixes the bug.
Allow the user to pass in a pre-allocated array and use it if the number
of boxes permits. This eliminates the frequent allocations during clipping
by toolkits.
Small numbers of traps are frequently generated from either a path of a
single line, or that of a rectangle. Therefore should embed sufficient
storage with cairo_traps_t to accommodate the stroke of a single rectangle
(e.g. a pango unknown glyph hexbox) to avoid frequent allocations.
First try to use a stack buffer for the glyphs and clusters if the user
calls cairo_show_text() - for example, as pango does to draw the unknown hex
box.
By using a NULL backend for the error surfaces, instead of a pointer to
the image surface backend end, we save a few lookup/redirections during
dynamic linking.
Ginn Chen reported a regression with Firefox where "the whole area of web
page is transparent until it redraws", and bisected it to the change to
lazily clear the clip.
The bug would appears to be when we have an inconsistent GC clip - i.e.
the clip on the surface has been cleared, but we have not yet used and
thus cleared the GC, so that we did not mark the GC as having a clip set
when we freed it.
Behdad prefers these to be upper-case to be consistent with G_UNLIKELY and
friends. However, as I intend to use these for nearly all instances of
if(status), I suggest that we keep to the short and not so loud:
if (unlikely (status))
return status;
Reparsing the dwarf info for every lookup is very slow, so cache the
symbol lookups. This initial implementation is unbounded in the simple
belief that the actual number of unique lookups during a program's
lifetime should be fairly small. (Extending to a bounded MRU list is left
as an exercise for the reader.)