diff options
author | Matthias Clasen <mclasen@redhat.com> | 2017-09-03 19:35:02 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2017-09-03 19:35:02 -0400 |
commit | 59b12064686a2ee183ca6b686bd088f471383b95 (patch) | |
tree | e3849f885b7f6717b74bac5d626560b8242172db /gsk/gskrendernodeimpl.c | |
parent | ccc587cca76da079bafedad6797a9215d8ce8f68 (diff) | |
download | gtk+-59b12064686a2ee183ca6b686bd088f471383b95.tar.gz |
Avoid empty nodes another way
Make gsk_text_node_new return NULL if the extents are empty.
Diffstat (limited to 'gsk/gskrendernodeimpl.c')
-rw-r--r-- | gsk/gskrendernodeimpl.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c index 0b0981efe4..48fecc36b6 100644 --- a/gsk/gskrendernodeimpl.c +++ b/gsk/gskrendernodeimpl.c @@ -4041,6 +4041,13 @@ gsk_text_node_new (PangoFont *font, GskTextNode *self; PangoRectangle ink_rect; + pango_glyph_string_extents (glyphs, font, &ink_rect, NULL); + pango_extents_to_pixels (&ink_rect, NULL); + + /* Don't create nodes with empty bounds */ + if (ink_rect.width == 0 || ink_rect.height == 0) + return NULL; + self = (GskTextNode *) gsk_render_node_new (&GSK_TEXT_NODE_CLASS, 0); self->font = g_object_ref (font); @@ -4053,8 +4060,6 @@ gsk_text_node_new (PangoFont *font, self->has_color = font_has_color_glyphs (font); - pango_glyph_string_extents (glyphs, font, &ink_rect, NULL); - pango_extents_to_pixels (&ink_rect, NULL); graphene_rect_init (&self->render_node.bounds, x_offset + base_x + ink_rect.x, |