aboutsummaryrefslogtreecommitdiffstats
path: root/readers.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2014-11-20 12:32:01 +0100
committerGerd Hoffmann <kraxel@redhat.com>2017-03-08 11:27:55 +0100
commitf2c664a04fa6cf49b3719a0cc4c59f57bab04948 (patch)
treef0f9fe151dcb2260b953d3bc840bae6b3796a1a6 /readers.c
parentf897a5ee212491ea5d0560eeb1ca4f6bcfbfe111 (diff)
downloadfbida-f2c664a04fa6cf49b3719a0cc4c59f57bab04948.tar.gz
use pixman images for storage
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)