Toolkits like GTK+ almost always set a simple rectangular clip mask before
any cairo operation, so avoid the allocation for this simple case by
embedding a small number of XRectangles into the surface structure.
_cairo_surface_create_similar_solid() creates a fresh pattern to wrap
color, however sometimes the caller already has that pattern available.
In those circumstances we can pass the pattern as well as the color and
avoid the extra allocation.
For opaque surfaces the backends may use simpler code paths - for
example, the xlib backend may be able to use the Core protocol rather
than Render. So we only generate a surface with an alpha component if
the color is not opaque.
The so-attributed-to-X-server bug was that cairo maps the drawing
region to the pattern space, rounds the box, and uploads only that
part of the source surface to the X server. Well, this only works for
NEAREST filter as any more sophisticated filter needs to sneak a peek
at the neighboring pixels around the edges too.
The right fix involves taking into account the filter used, and the
pattern matrix, but for most cases, a single pixel should be enough.
Not sure about scaling down...
Anyway, this is just a workaround to get 1.4.4 out of the door. I'll
commit a proper fix soon.
Due to the interaction between multiple threads showing glyphs and
asynchronous CloseDisplays, it is possible for a font to maintain a
cairo_xlib_screen_info_t beyond the CloseDisplay. The simple solution
is to add a reference count in order to track the lifetime of the
cairo_xlib_screen_info_t correctly.
This new feature isn't appropriate for a minor cairo release,
(we're between 1.4.2 and 1.4.4 right now), but will make a
lot of sense during 1.5.
The code being reverted here was originally added with the
following commit:
46eab95698
but this change reverts only the public-facing parts of it.
In order to avoid recursive dead-locks where whilst one thread holds the
scaled font lock and is waiting on the XLockDisplay() another thread catches
the CloseDisplay and then tries to acquire the scaled font lock, we drop
the list mutex whilst processing the callbacks.
Do not initialize font options when setting up the
cairo_xlib_screen_info_t corresponding to the display itself and not
associated with any screen. This avoids a potential NULL dereferences.
(Fixes https://bugs.freedesktop.org/show_bug.cgi?id=10517)
pixman_format_t is a simple structure used in short-term allocations and
suitable for on-stack allocation.
Killing the pixman_format_create()/pixman_format_destroy() pairs avoid
around 6% of the allocations during cairo-perf (e.g. 426,158 allocs out
of a total of 7,063,469).
It is possible for a scaled_font to be flagged as in error, though only
through a "true error" e.g. a malloc failure. However, when returning a font
from the cache it should not be in error. So if we find a error font in the
cache we remove it and return a new font.
These are all to satisfy new warnings caused by the preceding commit,
(which added cairo_warn to various function tables). While fixing the
propoagation, fix functions to declare a return type of cairo_status_t
instead of int.
The attribute was introduced with gcc-3.4, but the ability to suppress
warnings from misapplied attributes (-Wno-attributes) was only introduced
later. Without the supression, gcc will emit tens of warnings for each
compilation completely drowning the real errors that the programmer
must see.