aboutsummaryrefslogtreecommitdiffstats
path: root/readers.c
diff options
context:
space:
mode:
Diffstat (limited to 'readers.c')
-rw-r--r--readers.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/readers.c b/readers.c
index 53cb032..b7da842 100644
--- a/readers.c
+++ b/readers.c
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
+#include <assert.h>
#include "readers.h"
@@ -126,6 +127,32 @@ int load_free_extras(struct ida_image_info *info)
/* ----------------------------------------------------------------------- */
+void ida_image_alloc(struct ida_image *img)
+{
+ assert(img->p == NULL);
+ img->p = pixman_image_create_bits(PIXMAN_r8g8b8,
+ img->i.width, img->i.height, NULL, 0);
+}
+
+uint8_t *ida_image_scanline(struct ida_image *img, int y)
+{
+ uint8_t *scanline;
+
+ assert(img->p != NULL);
+ scanline = (void*)pixman_image_get_data(img->p);
+ scanline += pixman_image_get_stride(img->p) * y;
+ return scanline;
+}
+
+void ida_image_free(struct ida_image *img)
+{
+ assert(img->p != NULL);
+ pixman_image_unref(img->p);
+ img->p = NULL;
+}
+
+/* ----------------------------------------------------------------------- */
+
LIST_HEAD(loaders);
void load_register(struct ida_loader *loader)