aboutsummaryrefslogtreecommitdiff
path: root/font.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 /font.c
parentREADME: subpixel antialiasing has been implemented (diff)
refactor: break out stride calculation to new function
Diffstat (limited to 'font.c')
-rw-r--r--font.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/font.c b/font.c
index 17c66e1e..816b7e37 100644
--- a/font.c
+++ b/font.c
@@ -10,6 +10,7 @@
#define LOG_MODULE "font"
#define LOG_ENABLE_DBG 0
#include "log.h"
+#include "stride.h"
#define min(x, y) ((x) < (y) ? (x) : (y))
@@ -392,8 +393,7 @@ glyph_for_wchar(struct font *font, wchar_t wc, struct glyph *glyph)
break;
}
- /* Calculate stride. Copied from cairoint.h:CAIRO_STRIDE_FOR_WIDTH_BPP */
- int stride = (((PIXMAN_FORMAT_BPP(pix_format) * width + 7) / 8 + 4 - 1) & -4);
+ int stride = stride_for_format_and_width(pix_format, width);
assert(stride >= bitmap->pitch);
uint8_t *data = malloc(rows * stride);