[cairo-commit] src/cairo-scaled-font.c

Adrian Johnson ajohnson at kemper.freedesktop.org
Thu Mar 10 08:31:15 UTC 2016


 src/cairo-scaled-font.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 72c9a022ac2f1b9c9afa349e0977dcd89fa56f2d
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Feb 21 09:07:40 2016 +1030

    scaled-font: don't store pointer in hash value

diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index ac80c97..b2557d4 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -85,7 +85,7 @@ static cairo_cache_t cairo_scaled_glyph_page_cache;
 #define CAIRO_SCALED_GLYPH_PAGE_SIZE 32
 struct _cairo_scaled_glyph_page {
     cairo_cache_entry_t cache_entry;
-
+    cairo_scaled_font_t *scaled_font;
     cairo_list_t link;
 
     unsigned int num_glyphs;
@@ -477,7 +477,7 @@ _cairo_scaled_glyph_page_pluck (void *closure)
 
     assert (! cairo_list_is_empty (&page->link));
 
-    scaled_font = (cairo_scaled_font_t *) page->cache_entry.hash;
+    scaled_font = page->scaled_font;
 
     CAIRO_MUTEX_LOCK (scaled_font->mutex);
     _cairo_scaled_glyph_page_destroy (scaled_font, page);
@@ -2824,7 +2824,7 @@ _cairo_scaled_glyph_page_can_remove (const void *closure)
     const cairo_scaled_glyph_page_t *page = closure;
     const cairo_scaled_font_t *scaled_font;
 
-    scaled_font = (cairo_scaled_font_t *) page->cache_entry.hash;
+    scaled_font = page->scaled_font;
     return scaled_font->cache_frozen == 0;
 }
 
@@ -2853,6 +2853,7 @@ _cairo_scaled_font_allocate_glyph (cairo_scaled_font_t *scaled_font,
 	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 
     page->cache_entry.hash = (unsigned long) scaled_font;
+    page->scaled_font = scaled_font;
     page->cache_entry.size = 1; /* XXX occupancy weighting? */
     page->num_glyphs = 0;
 


More information about the cairo-commit mailing list