From 72d98fd99f350d2592c63ee6e1ac28cd38fbcb93 Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Fri, 10 Jun 2022 00:24:54 +0100 Subject: Avoid an unnecessary copy of the image buffer. By pointing Cairo at the mmap-ed file used to create wl_shm buffers, we can eliminate a memcpy() on every draw, providing a decent speedup (especially for large window sizes). This comes at the expense of having to keep track of two Cairo contexts, one for each of our two buffers used for double buffering. Additionally, a single memcpy() is still required for initialisation of the second buffer, so the startup latency isn't affected much. --- src/surface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/surface.h') diff --git a/src/surface.h b/src/surface.h index 6016551..68f9a31 100644 --- a/src/surface.h +++ b/src/surface.h @@ -22,7 +22,7 @@ struct surface { bool redraw; }; -void surface_initialise( +void surface_init( struct surface *surface, struct wl_shm *wl_shm); void surface_destroy(struct surface *surface); -- cgit v1.2.3