mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-02 15:28:03 +02:00
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). |
||
|---|---|---|
| .. | ||
| .gitignore | ||
| cairo-boilerplate-beos-private.h | ||
| cairo-boilerplate-beos.cpp | ||
| cairo-boilerplate-directfb-private.h | ||
| cairo-boilerplate-directfb.c | ||
| cairo-boilerplate-getopt.c | ||
| cairo-boilerplate-getopt.h | ||
| cairo-boilerplate-glitz-agl.c | ||
| cairo-boilerplate-glitz-glx.c | ||
| cairo-boilerplate-glitz-private.h | ||
| cairo-boilerplate-glitz-wgl.c | ||
| cairo-boilerplate-pdf-private.h | ||
| cairo-boilerplate-pdf.c | ||
| cairo-boilerplate-ps-private.h | ||
| cairo-boilerplate-ps.c | ||
| cairo-boilerplate-quartz-private.h | ||
| cairo-boilerplate-quartz.c | ||
| cairo-boilerplate-scaled-font.h | ||
| cairo-boilerplate-script-private.h | ||
| cairo-boilerplate-script.c | ||
| cairo-boilerplate-sdl-private.h | ||
| cairo-boilerplate-sdl.c | ||
| cairo-boilerplate-svg-private.h | ||
| cairo-boilerplate-svg.c | ||
| cairo-boilerplate-system.c | ||
| cairo-boilerplate-system.h | ||
| cairo-boilerplate-test-surfaces-private.h | ||
| cairo-boilerplate-test-surfaces.c | ||
| cairo-boilerplate-win32-printing.c | ||
| cairo-boilerplate-win32-private.h | ||
| cairo-boilerplate-win32.c | ||
| cairo-boilerplate-xcb-private.h | ||
| cairo-boilerplate-xcb.c | ||
| cairo-boilerplate-xlib-private.h | ||
| cairo-boilerplate-xlib.c | ||
| cairo-boilerplate-xlib.h | ||
| cairo-boilerplate.c | ||
| cairo-boilerplate.h | ||
| check-link.c | ||
| Makefile.am | ||
| Makefile.sources | ||
| Makefile.win32 | ||
| Makefile.win32.features | ||
| README | ||
This directory provides code that is common to both of cairo's tests suites: * The test suite for correctness in test/ * The test suite for performance in perf/ We call it boilerplate as it consists primarily of the boilerplate code necessary for initializing a backend in order to create a surface for that backend. The code here just might be useful for someone looking to get started writing cairo code to use a particular backend, (but there are no promises that the boilerplate code found here for any particular backend is exemplary).