render: remove all traces of glyph-sequence

This was used to optimize the call(s) to cairo_show_glyphs(), which we
aren't using anymore.
This commit is contained in:
Daniel Eklöf 2019-07-30 19:33:56 +02:00
parent f5e9b7b048
commit efdb69f2d8
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -25,17 +25,6 @@ attrs_to_font(struct terminal *term, const struct attributes *attrs)
return &term->fonts[idx];
}
struct glyph_sequence {
cairo_glyph_t glyphs[100000];
cairo_glyph_t *g;
int count;
struct attributes attrs;
uint32_t foreground;
};
static struct glyph_sequence gseq;
static inline struct rgb
color_hex_to_rgb(uint32_t color)
{
@ -54,27 +43,6 @@ color_dim(struct rgb *rgb)
rgb->b /= 2.;
}
static void
gseq_flush(struct terminal *term, struct buffer *buf)
{
if (gseq.count == 0)
return;
assert(NULL);
struct rgb fg = color_hex_to_rgb(gseq.foreground);
if (gseq.attrs.dim)
color_dim(&fg);
#if 0
cairo_set_scaled_font(buf->cairo, attrs_to_font(term, &gseq.attrs)->font);
cairo_set_source_rgb(buf->cairo, fg.r, fg.g, fg.b);
cairo_show_glyphs(buf->cairo, gseq.glyphs, gseq.count);
#endif
gseq.g = gseq.glyphs;
gseq.count = 0;
}
static void
draw_underline(const struct terminal *term, struct buffer *buf, size_t buf_idx,
const struct font *font, struct rgb color, double x, double y)
@ -251,27 +219,6 @@ render_cell(struct terminal *term, struct buffer *buf, size_t buf_idx,
if (cell->attrs.strikethrough)
draw_strikeout(term, buf, buf_idx, attrs_to_font(term, &cell->attrs), fg, x, y);
/*
* cairo_show_glyphs() apparently works *much* faster when
* called once with a large array of glyphs, compared to
* multiple calls with a single glyph.
*
* So, collect glyphs until cell attributes change, then we
* 'flush' (render) the glyphs.
*/
if (memcmp(&cell->attrs, &gseq.attrs, sizeof(cell->attrs)) != 0 ||
gseq.count >= sizeof(gseq.glyphs) / sizeof(gseq.glyphs[0]) - 10 ||
gseq.foreground != _fg)
{
if (gseq.count >= sizeof(gseq.glyphs) / sizeof(gseq.glyphs[0]) - 10)
LOG_WARN("hit glyph limit");
gseq_flush(term, buf);
gseq.attrs = cell->attrs;
gseq.foreground = _fg;
}
struct font *font = attrs_to_font(term, &cell->attrs);
const struct glyph *glyph = font_glyph_for_utf8(font, cell->c);
if (glyph != NULL) {
@ -423,9 +370,6 @@ grid_render(struct terminal *term)
struct buffer *buf = shm_get_buffer(term->wl.shm, term->width, term->height, 1 + term->render.workers.count);
cairo_set_operator(buf->cairo[0], CAIRO_OPERATOR_SOURCE);
gseq.g = gseq.glyphs;
gseq.count = 0;
bool all_clean = tll_length(term->grid->scroll_damage) == 0;
/* Erase old cursor (if we rendered a cursor last time) */
@ -439,9 +383,6 @@ grid_render(struct terminal *term)
term->render.last_cursor.in_view.col,
term->render.last_cursor.in_view.row, false);
/* Must flush now since scroll damage will shift the entire pixmap */
gseq_flush(term, buf);
wl_surface_damage_buffer(
term->wl.surface,
term->render.last_cursor.in_view.col * term->cell_width,
@ -613,8 +554,6 @@ grid_render(struct terminal *term)
term->cell_width, term->cell_height);
}
gseq_flush(term, buf);
if (all_clean) {
buf->busy = false;
return;