diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-04-22 13:29:56 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-04-22 13:29:56 +0200 |
| commit | 67893dc14d10f49a76652ff384ab2bf4a945ca30 (patch) | |
| tree | c0612519116b0cfad0c1a1ae9df9beb92a9908e0 /swt.c | |
| parent | dc8f8644293b17f056edefa9e0e4a786686816a1 (diff) | |
add glyph caching
Diffstat (limited to 'swt.c')
| -rw-r--r-- | swt.c | 19 |
1 files changed, 13 insertions, 6 deletions
@@ -261,7 +261,6 @@ draw_glyph(Glyph g, int x, int y) ); } - draw_char( win.canvas, win.fontcache, @@ -270,6 +269,14 @@ draw_glyph(Glyph g, int x, int y) borderpx + y * win.fontcache->box.height + win.fontcache->fontsize, fg ); + + wl_surface_damage_buffer( + win.surface.wl, + borderpx + x * win.fontcache->box.width, + borderpx + y * win.fontcache->box.height, + win.fontcache->box.width, + win.fontcache->box.height + ); } @@ -449,9 +456,7 @@ draw_frame() void commit_surface() { - push_buffer(win.canvas); wl_surface_attach(win.surface.wl, win.canvas->buffer, 0, 0); - wl_surface_damage_buffer(win.surface.wl, 0, 0, win.width, win.height); wl_surface_commit(win.surface.wl); } @@ -462,8 +467,11 @@ surface_configure(void *data, struct xdg_surface *surface, uint32_t serial) int first_configure = win.canvas == 0; xdg_surface_ack_configure(surface, serial); - if (first_configure); + if (first_configure) { + wl_surface_attach(win.surface.wl, win.canvas->buffer, 0, 0); + wl_surface_damage_buffer(win.surface.wl, 0, 0, win.width, win.height); commit_surface(); + } } @@ -484,7 +492,6 @@ toplevel_configure(void *data, struct xdg_toplevel *toplevel, int32_t width, int } else { resize_drw(win.canvas, width, height); } - draw_frame(); win.tty.width = (win.width - 2 * borderpx) / win.fontcache->box.width; win.tty.height = (win.height - 2 * borderpx) / win.fontcache->box.height; @@ -891,9 +898,9 @@ setup() wl_surface_attach(client.pointer.surface, client.pointer.buffer, 0, 0); wl_surface_commit(client.pointer.surface); - wl_display_roundtrip(client.display); draw(); + commit_surface(); } |