Frequently cairo_set_source_rgb[a]() is used to replace the current
solid-pattern source with a new one of a different colour. The current
pattern is very likely to be unshared and unmodified and so it is likely
just to be immediately freed [or rather simply moved to recently freed
cache]. However as the last active pattern it is likely to cache-warm and
suitable to satisfy the forthcoming allocation. So by setting the current
pattern to 'none' we can move the pattern to the freed list before we
create the new pattern and hopefully immediately reuse it.
Unfortunately one cannot cache live patterns and return a fresh reference
instead of creating new ones as patterns can be modified by the user and
so cannot be transparently shared between different users. However,
solid colour allocation is still a frequent operation, so we maintain a
small cache of recently freed patterns to reduce the malloc pressure.
We use a small cache of size 16 for patterns created from solid colors,
e.g. cairo_set_source_rgb(). This helps with toolkits that draw many
widgets using the same colour scheme.
The cache uses a static index variable, which itself acts like a cache
of size 1, remembering the most recently used colour. So repeated
lookups for the same colour hit immediately. If that fails, the cache
is searched linearly, and if that fails too, a new pattern is created
and a random member of the cache is evicted.
All mutex declarations have been moved to cairo-mutex-list.h.
This should avoid breaking of less frequently tested backends,
when mutexes are introduced or when existing mutexes are renamed.
Instead of initializing mutexes on library startup, mutexes are
lazily initialized within the few entry points of now by calling
CAIRO_MUTEX_INITIALIZE(). Currently only the OS/2 backend takes
care about releasing global mutexes. Therefore there is no counter
part of that macro for finalizing all global mutexes yet - but
as cairo-backend-os2.c shows such a function would be quite
easy to implement.
This test is known to sometimes cause an X server to enter a near-
infinite loop. That's a reall unkind thing to inflict upon our
users who are being nice enough to test cairo. Let's disable
this test for the 1.4.2 release.
We detect an error in the surface before calling into private surface-modifying
functions, (such as _cairo_surface_set_font_options), that don't have the
nil-surface protection of public functions.
This should fix the problem reported (again) in this bug report:
cairo crashes in cairo_create_simular if nil surface returned by other->backend->create_similar
https://bugs.freedesktop.org/show_bug.cgi?id=9844
Though I haven't succeeded in replicating the bug yet, (perhaps a system
difference in allowing writes to read-only memory or not, or something
like that).
The original test for 'if (surface->visual)' dates back to a very old
assumption that if the xlib surface was created with an XRenderFormat
that the surface->visual field would be set to NULL. This assumption
was broken years ago with the following commit:
0c05b23b31
This fixes the crash reported here:
BadMatch when running gnome-terminal with the murrine-0.51 gtk engine
https://bugs.freedesktop.org/show_bug.cgi?id=10250
Applies the ctm to text output on the quartz surface. This corrects
the text-pattern test, and also corrects the size of text when the
ctm includes a scale.
The ATSUStyle that we store in the font contains references to
the size and font matrix; we need to store them in the font so that
they are not released before the style.
cairo-perf and the X server should be bound to CPUs (either the same
or separate) on SMP systems. Not doing so causes random results when
the X server is moved to or from cairo-perf's CPU during the
benchmarks.
Thanks to Thomas Klausner for passing the report along.
This fixes the following bug report:
hidden attribute does not work with Solaris ld
https://bugs.freedesktop.org/show_bug.cgi?id=10227
And as Behdad points out, an even better fix would be to
move checks for supported visibility attribute to configure.
The man page for GNU find says:
-not expr
Same as ! expr, but not POSIX compliant.
And actually, on e.g. NetBSD, "-not" is not supported.
This resolved the following bug:
https://bugs.freedesktop.org/show_bug.cgi?id=10226
Quite some time ago we switched from using deflate-based compression to LZW
for the ps backend, (which allows it to target PostScript Level 2 instead of
PostScript Level 3). Now, we finally drop the fact that the ps backend was
still requiring zlib in order to build.
Otherwise we risk pulling in an otherwise-unneeded dependency on zlib.
This fixes the bug reported here:
Without PDF surface backend we don't need cairo-deflate-stream
https://bugs.freedesktop.org/show_bug.cgi?id=10202
When a single function accepts pointers for multiple return values,
the convention is that it's legal for the user to pass NULL for
those pointers in case the user is only interested in some subset
of the values.
This was already properly implemented for functions such as
cairo_pattern_get_rgba, etc.
Here we fix four functions to follow the same convention:
cairo_stroke_extents
cairo_fill_extents
cairo_clip_extents
cairo_surface_get_device_offset