diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-03-28 20:22:24 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-03-30 00:34:52 -0400 |
commit | 2c33550048f5dd1accd629163cc363122b6a3cd3 (patch) | |
tree | 9f742620b22ba4e13d3bb9c02d6b7a0d62fd5443 /gsk | |
parent | 3add99a9a84845757e76d49f9c887f5d7a074637 (diff) | |
download | gtk+-2c33550048f5dd1accd629163cc363122b6a3cd3.tar.gz |
gsk: Avoid empty glyphs early
Strip out PANGO_GLYPH_EMPTY when text nodes are
constructed. Then we don't have to check this special
case in the inner loop in visit_text_node.
Diffstat (limited to 'gsk')
-rw-r--r-- | gsk/gskrendernodeimpl.c | 10 | ||||
-rw-r--r-- | gsk/ngl/gsknglrenderjob.c | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c index d611977acc..640c792268 100644 --- a/gsk/gskrendernodeimpl.c +++ b/gsk/gskrendernodeimpl.c @@ -4435,9 +4435,15 @@ gsk_text_node_new (PangoFont *font, self->has_color_glyphs = font_has_color_glyphs (font); self->color = *color; self->offset = *offset; - self->num_glyphs = glyphs->num_glyphs; self->glyphs = g_malloc_n (glyphs->num_glyphs, sizeof (PangoGlyphInfo)); - memcpy (self->glyphs, glyphs->glyphs, glyphs->num_glyphs * sizeof (PangoGlyphInfo)); + + /* skip empty glyphs */ + self->num_glyphs = 0; + for (int i = 0; i < glyphs->num_glyphs; i++) + { + if (glyphs->glyphs[i].glyph != PANGO_GLYPH_EMPTY) + self->glyphs[self->num_glyphs++] = glyphs->glyphs[i]; + } graphene_rect_init (&node->bounds, offset->x + ink_rect.x - 1, diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c index b45f33b7a8..fa2c9c8cb9 100644 --- a/gsk/ngl/gsknglrenderjob.c +++ b/gsk/ngl/gsknglrenderjob.c @@ -2720,9 +2720,6 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob *job, float cy; guint texture_id; - if G_UNLIKELY (gi->glyph == PANGO_GLYPH_EMPTY) - continue; - lookup.glyph = gi->glyph; cx = (float)(x_position + gi->geometry.x_offset) / PANGO_SCALE; |