summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/font.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/font.c b/src/font.c
index c2300b5..76510a6 100644
--- a/src/font.c
+++ b/src/font.c
@@ -26,6 +26,7 @@
#include <png.h>
#include <linux/font.h>
+#include "image.h"
#define FONT_H(f) ((size_t) (f)->desc.height)
#define FONT_W(f) ((size_t) (f)->desc.width)
@@ -83,13 +84,13 @@ font_render(struct font *font, png_const_colorp fg, png_const_colorp bg,
for (y = 0, r = row * FONT_H(font); y < FONT_H(font); ++y, ++r) {
for (x = 0, c = col * FONT_W(font); x < FONT_W(font); ++x, ++c){
if (CHAR_PIXEL(font, ch, x, y)) {
- *(&rows[r][c] + 0) = fg->red;
- *(&rows[r][c] + 1) = fg->green;
- *(&rows[r][c] + 2) = fg->blue;
+ rows[r][c * IMAGE_PIXEL_SIZE + 0] = fg->red;
+ rows[r][c * IMAGE_PIXEL_SIZE + 1] = fg->green;
+ rows[r][c * IMAGE_PIXEL_SIZE + 2] = fg->blue;
} else {
- *(&rows[r][c] + 0) = bg->red;
- *(&rows[r][c] + 1) = bg->green;
- *(&rows[r][c] + 2) = bg->blue;
+ rows[r][c * IMAGE_PIXEL_SIZE + 0] = bg->red;
+ rows[r][c * IMAGE_PIXEL_SIZE + 1] = bg->green;
+ rows[r][c * IMAGE_PIXEL_SIZE + 2] = bg->blue;
}
}
}