summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/image.c8
-rw-r--r--src/image.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/image.c b/src/image.c
index 45c3352..04dca72 100644
--- a/src/image.c
+++ b/src/image.c
@@ -30,10 +30,6 @@
#include "i18n.h"
#include "text.h"
-#define BIT_DEPTH 8
-#define CHANNELS 3
-#define PIXEL_SIZE ((BIT_DEPTH + 7) / 8) * CHANNELS
-
struct image {
png_structp png_ptr;
png_infop info_ptr;
@@ -84,12 +80,12 @@ image_render(struct image *image, struct text *text, struct font *font)
height = text_get_height(text) * font_get_height(font);
png_set_IHDR(image->png_ptr, image->info_ptr, width, height,
- BIT_DEPTH, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
+ IMAGE_BIT_DEPTH, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
rows = png_malloc(image->png_ptr, height * sizeof(*rows));
for (i = 0; i < height; ++i) {
- rows[i] = png_malloc(image->png_ptr, width * PIXEL_SIZE);
+ rows[i] = png_malloc(image->png_ptr, width * IMAGE_PIXEL_SIZE);
}
png_set_rows(image->png_ptr, image->info_ptr, rows);
diff --git a/src/image.h b/src/image.h
index 361296e..1177cd0 100644
--- a/src/image.h
+++ b/src/image.h
@@ -26,6 +26,10 @@
#include "font.h"
+#define IMAGE_BIT_DEPTH 8
+#define IMAGE_CHANNELS 3
+#define IMAGE_PIXEL_SIZE ((IMAGE_BIT_DEPTH + 7) / 8) * IMAGE_CHANNELS
+
struct image;
struct image *