aboutsummaryrefslogtreecommitdiff
path: root/stride.h
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 /stride.h
parentREADME: subpixel antialiasing has been implemented (diff)
refactor: break out stride calculation to new function
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);
+}