render: render_osd(): don’t re-instantiate foreground color for each glyph

This commit is contained in:
Daniel Eklöf 2021-07-22 23:27:05 +02:00
parent 5c683d2c08
commit bf285ae00a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -1597,6 +1597,7 @@ render_osd(struct terminal *term,
pixman_color_t fg = color_hex_to_pixman(_fg);
const int x_ofs = term->font_x_ofs;
pixman_image_t *src = pixman_image_create_solid_fill(&fg);
for (size_t i = 0; i < wcslen(text); i++) {
const struct fcft_glyph *glyph = fcft_glyph_rasterize(
@ -1615,6 +1616,7 @@ render_osd(struct terminal *term,
x += glyph->advance.x;
}
pixman_image_unref(src);
pixman_image_set_clip_region32(buf->pix[0], NULL);
xassert(buf->width % term->scale == 0);