aboutsummaryrefslogtreecommitdiff
path: root/stride.h
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-02 23:08:08 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-02 23:08:08 +0000
commit5cc2f94668d2852bbc3de1056526a1b829a32f7f (patch)
treef58e4a29bbad296f265f36048a76090e49c44565 /stride.h
parentrender: mark cell overflowed into as dirty (diff)
parentbox-drawing: drop ‘pragma GCC optimize(“Os”)’ (diff)
Merge branch 'box-drawing'
Closes #198
Diffstat (limited to 'stride.h')
-rw-r--r--stride.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/stride.h b/stride.h
new file mode 100644
index 00000000..b2c71a71
--- /dev/null
+++ b/stride.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#include <pixman.h>
+
+static inline int
+stride_for_format_and_width(pixman_format_code_t format, int width)
+{
+ return (((PIXMAN_FORMAT_BPP(format) * width + 7) / 8 + 4 - 1) & -4);
+}