aboutsummaryrefslogtreecommitdiff
path: root/shm.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-08-18 15:59:43 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-08-18 15:59:43 +0000
commit33b5210a6a69c04c8de7589ac8c0b86c38ce75c3 (patch)
treecf4078d3ff657167762ca82646229079cc50b7f5 /shm.c
parentREADME: subpixel antialiasing has been implemented (diff)
refactor: break out stride calculation to new function
Diffstat (limited to 'shm.c')
-rw-r--r--shm.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/shm.c b/shm.c
index ebff8a1a..7476aef5 100644
--- a/shm.c
+++ b/shm.c
@@ -11,6 +11,7 @@
#define LOG_MODULE "shm"
#include "log.h"
+#include "stride.h"
#include "tllist.h"
static tll(struct buffer) buffers;
@@ -69,10 +70,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, size_t copies)
goto err;
}
- /* TODO: copied from font.c */
- /* Calculate stride. Copied from cairoint.h:CAIRO_STRIDE_FOR_WIDTH_BPP */
- int bpp = 32;
- const int stride = (((bpp * width + 7) / 8 + 4 - 1) & -4);
+ const int stride = stride_for_format_and_width(PIXMAN_a8r8g8b8, width);
/* Total size */
size = stride * height;