summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-07-17 18:53:01 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-07-17 18:53:01 (EDT)
commit34b3f44f06f69919b9ee0099ef93711fdce6ca15 (patch)
tree9e305c4f0efcee07060fdad01ca6f4132590ce95
parent39b1f0bd678e85816874c40cf8f5a51133c982b5 (diff)
font_render(): Fix pixel size
-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;
}
}
}