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.
The function calls that get the new treatment here are:
_cairo_meta_surface_replay
_cairo_surface_show_page
_cairo_array_append
all within _cairo_svg_surface_emit_meta_surface
Also fix all callers to notice and propagate the error, (though
some paths will still lose the CAIRO_STATUS_INVALID_MATRIX value
due to a return value of NULL at one point).
Fixing this uncovered a leak of a CAIRO_INT_STATUS_UNSUPPORTED value
up to cairo_show_page, (and similarly to cairo_copy_page). There was
really no good reason for _cairo_surface_show_page and
_cairo_surface_copy_page to be returning cairo_int_status_t. Fix
this by simply handling the UNSUPPORTED return at the surface layer
instead of the gstate layer.
Obviously, the new name is _cairo_pdf_surface_emit_to_unicode_stream which
is consistent with the to_unicode_stream identifiers already existing in
the implementation.