diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-07-30 13:51:02 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-07-30 19:46:07 -0400 |
commit | ed41c4692609bb140cb4c1f4b458ef113fd23e7a (patch) | |
tree | c03f40b8abd8bccc944841798db90626fa0d4ac3 | |
parent | a460fb27345b38f875823913bd046868a6c8c5f9 (diff) | |
download | gtk+-ed41c4692609bb140cb4c1f4b458ef113fd23e7a.tar.gz |
ngl: Bypass pango for glyph cache rendering
We can just use cairo directly here,
and cut out some layers of pango in the middle.
-rw-r--r-- | gsk/ngl/gsknglglyphlibrary.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/gsk/ngl/gsknglglyphlibrary.c b/gsk/ngl/gsknglglyphlibrary.c index 627f35f59e..9f269d8643 100644 --- a/gsk/ngl/gsknglglyphlibrary.c +++ b/gsk/ngl/gsknglglyphlibrary.c @@ -165,8 +165,7 @@ render_glyph (cairo_surface_t *surface, const GskNglGlyphValue *value) { cairo_t *cr; - PangoGlyphString glyph_string; - PangoGlyphInfo glyph_info; + cairo_glyph_t glyph; g_assert (surface != NULL); g_assert (scaled_font != NULL); @@ -175,18 +174,11 @@ render_glyph (cairo_surface_t *surface, cairo_set_scaled_font (cr, scaled_font); cairo_set_source_rgba (cr, 1, 1, 1, 1); - glyph_info.glyph = key->glyph; - glyph_info.geometry.width = value->ink_rect.width * 1024; - if (glyph_info.glyph & PANGO_GLYPH_UNKNOWN_FLAG) - glyph_info.geometry.x_offset = 256 * key->xshift; - else - glyph_info.geometry.x_offset = 256 * key->xshift - value->ink_rect.x * 1024; - glyph_info.geometry.y_offset = 256 * key->yshift - value->ink_rect.y * 1024; - - glyph_string.num_glyphs = 1; - glyph_string.glyphs = &glyph_info; + glyph.index = key->glyph; + glyph.x = 0.25 * key->xshift - value->ink_rect.x; + glyph.y = 0.25 * key->yshift - value->ink_rect.y; - pango_cairo_show_glyph_string (cr, key->font, &glyph_string); + cairo_show_glyphs (cr, &glyph, 1); cairo_destroy (cr); cairo_surface_flush (surface); |