summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2019-01-10 17:14:48 +0100
committerTimm Bäder <mail@baedert.org>2019-01-10 17:14:48 +0100
commitd55fc8b7b151cbd8210a4229b611c95a15d3ea88 (patch)
tree43bee24235652f75920cdb07c538300a2a7755aa
parente72d0a9118de996ccdf1250c61c9bc6febf51b52 (diff)
downloadgtk+-d55fc8b7b151cbd8210a4229b611c95a15d3ea88.tar.gz
gl renderer: Dont't try to draw glyphs at scale 0
Fixes #1475
-rw-r--r--gsk/gl/gskglglyphcache.c3
-rw-r--r--gsk/gl/gskglglyphcacheprivate.h2
-rw-r--r--gsk/gl/gskglrenderer.c2
3 files changed, 5 insertions, 2 deletions
diff --git a/gsk/gl/gskglglyphcache.c b/gsk/gl/gskglglyphcache.c
index dd0a3a5143..dc8d5149a9 100644
--- a/gsk/gl/gskglglyphcache.c
+++ b/gsk/gl/gskglglyphcache.c
@@ -322,12 +322,13 @@ gsk_gl_glyph_cache_lookup (GskGLGlyphCache *cache,
value->draw_height = ink_rect.height;
value->timestamp = cache->timestamp;
value->atlas = NULL; /* For now */
+ value->scale = (guint)(scale * 1024);
key->font = g_object_ref (font);
key->glyph = glyph;
key->scale = (guint)(scale * 1024);
- if (ink_rect.width > 0 && ink_rect.height > 0)
+ if (ink_rect.width > 0 && ink_rect.height > 0 && key->scale > 0)
add_to_cache (cache, key, value);
g_hash_table_insert (cache->hash_table, key, value);
diff --git a/gsk/gl/gskglglyphcacheprivate.h b/gsk/gl/gskglglyphcacheprivate.h
index 4f162c4e38..d93bbdcfc6 100644
--- a/gsk/gl/gskglglyphcacheprivate.h
+++ b/gsk/gl/gskglglyphcacheprivate.h
@@ -59,6 +59,8 @@ struct _GskGLCachedGlyph
int draw_width;
int draw_height;
+ float scale;
+
guint64 timestamp;
};
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 1b3d15a794..cdac8a1410 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -496,7 +496,7 @@ render_text_node (GskGLRenderer *self,
text_scale);
/* e.g. whitespace */
- if (glyph->draw_width <= 0 || glyph->draw_height <= 0)
+ if (glyph->draw_width <= 0 || glyph->draw_height <= 0 || glyph->scale <= 0)
goto next;
cx = (double)(x_position + gi->geometry.x_offset) / PANGO_SCALE;