diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-02-28 13:35:14 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-02-28 13:35:14 +0100 |
commit | ff74e649dff91c2e88d6b969f31c635a5dc7c860 (patch) | |
tree | 4beb45b8a2b134369eab38d8ae06bb122fb86da1 | |
parent | 3b682fa8ba2ec1dc7ece77fa7214acbc98025dca (diff) | |
download | fbida-ff74e649dff91c2e88d6b969f31c635a5dc7c860.tar.gz |
some optimizations
-rw-r--r-- | fbcon.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -45,7 +45,7 @@ static struct cairo_state { cairo_surface_t *surface; cairo_t *context; tsm_age_t age; - int clear; + uint32_t tx, ty, clear; } state1, state2; static int dirty, pty; @@ -211,14 +211,13 @@ int tsm_draw_cb(struct tsm_screen *con, uint32_t id, .g = attr->fg / 255.0, .b = attr->fb / 255.0, }; - int sw = tsm_screen_get_width(con) * extents.max_x_advance; - int sh = tsm_screen_get_height(con) * extents.height; - int tx = (gfx->hdisplay - sw) / 2; - int ty = (gfx->vdisplay - sh) / 2; wchar_t ws[8]; char utf8[32]; int i; + if (s->age && age && age < s->age) + return 0; + if (posx == tsm_screen_get_cursor_x(con) && posy == tsm_screen_get_cursor_y(con) && !(tsm_screen_get_flags(con) & TSM_SCREEN_HIDE_CURSOR)) { @@ -228,8 +227,8 @@ int tsm_draw_cb(struct tsm_screen *con, uint32_t id, /* background */ cairo_rectangle(s->context, - tx + posx * extents.max_x_advance, - ty + posy * extents.height, + s->tx + posx * extents.max_x_advance, + s->ty + posy * extents.height, extents.max_x_advance * width, extents.height); cairo_set_source_rgb(s->context, bg.r, bg.g, bg.b); @@ -237,8 +236,8 @@ int tsm_draw_cb(struct tsm_screen *con, uint32_t id, /* char */ cairo_move_to(s->context, - tx + posx * extents.max_x_advance, - ty + posy * extents.height + extents.ascent); + s->tx + posx * extents.max_x_advance, + s->ty + posy * extents.height + extents.ascent); cairo_set_source_rgb(s->context, fg.r, fg.g, fg.b); for (i = 0; i < len && i < ARRAY_SIZE(ws)-1; i++) ws[i] = ch[i]; @@ -253,6 +252,8 @@ static void cairo_render(void) { static bool second; struct cairo_state *s; + int sw = tsm_screen_get_width(vts) * extents.max_x_advance; + int sh = tsm_screen_get_height(vts) * extents.height; if (state2.surface) second = !second; @@ -265,6 +266,8 @@ static void cairo_render(void) s->age = 0; } + s->tx = (gfx->hdisplay - sw) / 2; + s->ty = (gfx->vdisplay - sh) / 2; s->age = tsm_screen_draw(vts, tsm_draw_cb, s); cairo_show_page(s->context); |