summaryrefslogtreecommitdiff
path: root/src/cairo-debug.c
diff options
context:
space:
mode:
authorJorn Baayen <jorn@openedhand.com>2007-02-14 18:28:56 -0800
committerBehdad Esfahbod <behdad@behdad.org>2007-02-14 18:28:56 -0800
commit2715f2098127d04d2f9e304580a26cd0842c0e64 (patch)
tree4bff20ab73331df7b69ef72cebfe1f369fdd3e7b /src/cairo-debug.c
parentb31179478bf8c18245917caa1bee19bb61f336c1 (diff)
[cairo-pattern] Cache surface for solid patterns
We use a small cache of size 16 for surfaces created for solid patterns. This mainly helps with the X backends where we don't have to create a pattern for every operation, so we save a lot on X traffic. Xft uses a similar cache, so cairo's text rendering traffic with the xlib backend now completely matches that of Xft. The cache uses an static index variable, which itself acts like a cache of size 1, remembering the most recently used solid pattern. So repeated lookups for the same pattern hit immediately. If that fails, the cache is searched linearly, and if that fails too, a new surface is created and a random member of the cache is evicted. Only surfaces that are "compatible" are used. The definition of compatible is backend specific. For the xlib backend, it means that the two surfaces are allocated on the same display. Implementations for compatibility are provided for all backends that it makes sense.
Diffstat (limited to 'src/cairo-debug.c')
-rw-r--r--src/cairo-debug.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cairo-debug.c b/src/cairo-debug.c
index 7c299325..dd57dd78 100644
--- a/src/cairo-debug.c
+++ b/src/cairo-debug.c
@@ -68,4 +68,6 @@ cairo_debug_reset_static_data (void)
#if CAIRO_HAS_FT_FONT
_cairo_ft_font_reset_static_data ();
#endif
+
+ _cairo_pattern_reset_static_data ();
}