From f2c664a04fa6cf49b3719a0cc4c59f57bab04948 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 20 Nov 2014 12:32:01 +0100 Subject: use pixman images for storage --- readers.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'readers.c') diff --git a/readers.c b/readers.c index 53cb032..b7da842 100644 --- a/readers.c +++ b/readers.c @@ -2,6 +2,7 @@ #include #include #include +#include #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) -- cgit