mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
render: don't re-instantiate the foreground pixman source
This commit is contained in:
parent
b10436e49b
commit
ef637fb5e8
1 changed files with 5 additions and 6 deletions
11
render.c
11
render.c
|
|
@ -422,6 +422,8 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
||||||
if (cell->wc == 0 || cell->attrs.conceal)
|
if (cell->wc == 0 || cell->attrs.conceal)
|
||||||
goto draw_cursor;
|
goto draw_cursor;
|
||||||
|
|
||||||
|
pixman_image_t *clr_pix = pixman_image_create_solid_fill(&fg);
|
||||||
|
|
||||||
if (glyph != NULL) {
|
if (glyph != NULL) {
|
||||||
if (unlikely(pixman_image_get_format(glyph->pix) == PIXMAN_a8r8g8b8)) {
|
if (unlikely(pixman_image_get_format(glyph->pix) == PIXMAN_a8r8g8b8)) {
|
||||||
/* Glyph surface is a pre-rendered image (typically a color emoji...) */
|
/* Glyph surface is a pre-rendered image (typically a color emoji...) */
|
||||||
|
|
@ -433,12 +435,10 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Glyph surface is an alpha mask */
|
/* Glyph surface is an alpha mask */
|
||||||
pixman_image_t *src = pixman_image_create_solid_fill(&fg);
|
|
||||||
pixman_image_composite32(
|
pixman_image_composite32(
|
||||||
PIXMAN_OP_OVER, src, glyph->pix, pix, 0, 0, 0, 0,
|
PIXMAN_OP_OVER, clr_pix, glyph->pix, pix, 0, 0, 0, 0,
|
||||||
x + glyph->x, y + font_baseline(term) - glyph->y,
|
x + glyph->x, y + font_baseline(term) - glyph->y,
|
||||||
glyph->width, glyph->height);
|
glyph->width, glyph->height);
|
||||||
pixman_image_unref(src);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -452,17 +452,16 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
||||||
if (g == NULL)
|
if (g == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pixman_image_t *src = pixman_image_create_solid_fill(&fg);
|
|
||||||
pixman_image_composite32(
|
pixman_image_composite32(
|
||||||
PIXMAN_OP_OVER, src, g->pix, pix, 0, 0, 0, 0,
|
PIXMAN_OP_OVER, clr_pix, g->pix, pix, 0, 0, 0, 0,
|
||||||
/* Some fonts use a negative offset, while others use a
|
/* Some fonts use a negative offset, while others use a
|
||||||
* "normal" offset */
|
* "normal" offset */
|
||||||
x + (g->x < 0 ? term->cell_width : 0) + g->x,
|
x + (g->x < 0 ? term->cell_width : 0) + g->x,
|
||||||
y + font_baseline(term) - g->y,
|
y + font_baseline(term) - g->y,
|
||||||
g->width, g->height);
|
g->width, g->height);
|
||||||
pixman_image_unref(src);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
pixman_image_unref(clr_pix);
|
||||||
|
|
||||||
/* Underline */
|
/* Underline */
|
||||||
if (cell->attrs.underline) {
|
if (cell->attrs.underline) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue