Don't cache glyphs with fine subpixel grid

Having up to 16x16 variants of each glyph in the cache is
a bit too much, and GTK does not need any caching, since
it is doing its own caching in a texture atlas.
This commit is contained in:
Matthias Clasen 2025-03-22 10:28:18 -04:00
parent a5ca8899e4
commit 024617e5ec

View file

@ -960,6 +960,20 @@ composite_glyphs (void *_dst,
glyph_cache, pg - pglyphs, pglyphs);
}
/* Don't keep 64x64 versions of each glyph in the cache */
if (info->font->options.subpixel_positions == CAIRO_SUBPIXEL_POSITIONS_FINE) {
int res = _cairo_subpixel_resolution (info->font->options.subpixel_positions);
for (i = 0; i < info->num_glyphs; i++) {
unsigned long index = info->glyphs[i].index;
unsigned long xphase, yphase;
xphase = _cairo_subpixel_phase (info->glyphs[i].x, res);
yphase = _cairo_subpixel_phase (info->glyphs[i].y, res);
index = index | (xphase << XSHIFT) | (yphase << YSHIFT);
pixman_glyph_cache_remove (glyph_cache, info->font, (void *)(uintptr_t)index);
}
}
out_thaw:
pixman_glyph_cache_thaw (glyph_cache);