We failed to cleanup the font face correctly after an allocation failure
during _cairo_toy_font_face_init() leading to memleaks and live entries
being left in the font-face hash tables.
As a fun itch to scratch, I've been fixing incorrect uses of the
contraction "it's" in comments within the mozilla source tree (tracked
in https://bugzilla.mozilla.org/show_bug.cgi?id=458167 ), and I ran
across 6 instances of this typo in mozilla's snapshot of cairo.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Adds an error code replacing CAIRO_STATUS_NO_MEMORY in one case where it
is not really appropriate. CAIRO_STATUS_INVALID_SIZE is used by several
backends that do not support image sizes beyond 2^15 pixels on each side.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
The agreement on the mailing list was that returning NULL is the right
thing to do, and indeed the callers of _cairo_glitz_surface_create_similar
are prepared to receive NULL and return CAIRO_STATUS_INT_UNSUPPORTED in
that case.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Currently glyphs are cached independently in each font i.e. each font
maintains a cache of up to 256 glyphs, and there can be as many scaled fonts
in use as the application needs and references (we maintain a holdover
cache of 512 scaled fonts as well).
Alternatively, as in this patch, we can maintain a global pool of glyphs
split between all open fonts. This allows a heavily used individual font
to cache more glyphs than we could allow if we used per-font glyph caches,
but at the same time maintains fairness across all fonts (by using random
replacement) and provides a cap on the maximum number of global glyphs.
The glyphs are allocated in pages, which are cached in the global pool.
Using pages means we can exploit spatial locality within the font
(nearby indices are typically used in clusters) to reduce frequency of small
allocations and allow the scaled font to reserve a single MRU page of
glyphs. This caching dramatically reduces the cairo overhead during the
cairo-perf benchmarks, and drastically reduces the number of allocations
made by the application (for example browsing multi-lingual site with
firefox).
The bounding polygon of the control points, defines the extents of the
spline. Therefore if the control points are entirely contained within the
current path extents, so is the spline and we do not need to evaluate its
tight bounds.
Rename approximate_extents() to approximate_clip_extents() so that it is
consistent with the fill and stroke variants and clearer under what
circumstances you may wish to use it.
After a short wild goose chase to see why
cairo_image_surface_fill_rectangles() was appearing in the profile,
tweak init_and_set_source_surface() to remove the redundant clear and
to propagate any errors in the auxiliary context.
Use '(void)expr;' instead of 'if (expr) ;' to avoid getting the warning.
'if (expr) {}' is an option, however '(void)expr;' seems like a more common
idiom and getting warnings for __attribute__((warn_unsed_result)) functions is
probably prefered.
PDF requires font names of subsetted fonts to be preprended with
"XXXXXX+" where XXXXXX is a sequence of 6 uppercase letters unique the
font and the set of glyphs in the subset.
The i915 is able to special case gradients with just 2 color stops to
avoid creating temporary gradient textures, so add a 3 stop linear
gradient to compare the speed difference.
Cover the similar source with min/mag scale factors as well, so we can
compare the performance impact with scaled image sources. This is useful
to distinguish between transport overhead and transform cost.
Performing the unicode to index is quite expensive, the
FcFreeTypeCharIndex() taking over 12% in the cairo-perf text benchmarks.
By adding a simple cache of translated unicode indices, we save around 25%
of the lookups during benchmarks, with a relative reduction in runtime.
A filled equivalent of stroke-image, that checks that the pattern
matrices are applied correctly during fills - useful with the
segregation between fills and strokes introduced by spans.
This test attempts to trigger failures in those backend clone_similar
methods that have size restrictions on the resulting image. It also
triggers errors in scaling down large image surfaces as the image
backend also fails this test.
RTLD_DEFAULT is a gnu-ism (at least according to the manpage on my linux
system) so declare _GNU_SOURCE before including dlfcn.h and failing that
provide our own definition.
If we cannot test the xlib backend simply because there is no Display,
just report UNTESTED and do not clutter the output with superfluous
warnings [see the output from the buildbots for an example]. However,
keep the warnings around so that a developer can re-enable them
and so simply move them to a new "lower priority" macro.
As reported in https://bugs.freedesktop.org/show_bug.cgi?id=19283, the
fallback freetype version compare is broken inside the configure script as
the $1-$3 arguments are interpreted as the script is constructed. To avoid
making that awk comparison any more complicated, we import a version compare
from the autoconf archives - such that we have a reusable macro for the
furture.