diff options
author | Timm Bäder <mail@baedert.org> | 2019-07-28 10:58:10 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2019-07-28 10:58:10 +0200 |
commit | 1c93bef0d5ba08012a275815ae3549911d1ef459 (patch) | |
tree | 8309ddc8b9630fa4255ca8fc0bfffdfaeaa085c9 | |
parent | eea76e8cce65485c7057f9adc6bbd87730762d5a (diff) | |
download | gtk+-1c93bef0d5ba08012a275815ae3549911d1ef459.tar.gz |
glyph cache: check glyphs for scaled size
We can't rely on just the ink_rect, since that might be without the
scaled applied, which is what ends up on the texture.
Fixes #2046
-rw-r--r-- | gsk/gl/gskglglyphcache.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gsk/gl/gskglglyphcache.c b/gsk/gl/gskglglyphcache.c index 14ff40e453..341d1032ef 100644 --- a/gsk/gl/gskglglyphcache.c +++ b/gsk/gl/gskglglyphcache.c @@ -311,6 +311,7 @@ gsk_gl_glyph_cache_lookup (GskGLGlyphCache *cache, if (value == NULL) { PangoRectangle ink_rect; + const guint key_scale = (guint)(scale * 1024); pango_font_get_glyph_extents (font, glyph, &ink_rect, NULL); pango_extents_to_pixels (&ink_rect, NULL); @@ -324,7 +325,8 @@ gsk_gl_glyph_cache_lookup (GskGLGlyphCache *cache, value->timestamp = cache->timestamp; value->atlas = NULL; /* For now */ - if (ink_rect.width < 128 && ink_rect.height < 128) + if ((ink_rect.width * key_scale) < 128 && + (ink_rect.height * key_scale) < 128) { GlyphCacheKey *key; @@ -332,9 +334,11 @@ gsk_gl_glyph_cache_lookup (GskGLGlyphCache *cache, key->font = g_object_ref (font); key->glyph = glyph; - key->scale = (guint)(scale * 1024); + key->scale = key_scale; - if (ink_rect.width > 0 && ink_rect.height > 0 && key->scale > 0) + if (key->scale > 0 && + ink_rect.width * key->scale > 0 && + ink_rect.height * key->scale > 0) add_to_cache (cache, key, value); *cached_glyph_out = *value; |