Skip to content

Commit

Permalink
scaled-font: don't store pointer in hash value
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Johnson committed Mar 10, 2016
1 parent 3538ac3 commit 72c9a02
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/cairo-scaled-font.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 72c9a02

Please sign in to comment.