diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-11-21 15:04:47 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-01-29 10:10:39 +0000 |
commit | aaec63d48386ec825cd4d6e67b6adf7c5fd3b167 (patch) | |
tree | 6b13aa509a009acd55c7e4a15b0ff6fd45f0012d /boilerplate | |
parent | 54f6a49ebb18cf396823d0d70b95e4e264142171 (diff) |
[scaled-font] Global glyph cache
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).
Diffstat (limited to 'boilerplate')
-rw-r--r-- | boilerplate/cairo-boilerplate.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index 91032cde..dd34110c 100644 --- a/boilerplate/cairo-boilerplate.c +++ b/boilerplate/cairo-boilerplate.c @@ -866,10 +866,7 @@ void cairo_boilerplate_scaled_font_set_max_glyphs_cached (cairo_scaled_font_t *scaled_font, int max_glyphs) { - if (cairo_scaled_font_status (scaled_font)) - return; - - scaled_font->glyphs->max_size = max_glyphs; + /* XXX CAIRO_DEBUG */ } #if HAS_DAEMON |