From 7c7dc660e587eac1aa3c8b3405eba95ba558e682 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Sat, 15 Jun 2019 14:28:29 +0100 Subject: Big glfw refactor I did a lot of this in a very ad-hoc fashion with no proper commit history. As such, the kindest thing to do seemed to be to just squash it into this one commit. --- src/backend_libjpeg.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/backend_libjpeg.c') diff --git a/src/backend_libjpeg.c b/src/backend_libjpeg.c index e8942eb..3c7ead7 100644 --- a/src/backend_libjpeg.c +++ b/src/backend_libjpeg.c @@ -43,14 +43,15 @@ static void source_free(struct imv_source *src) free(src); } -static struct imv_bitmap *to_imv_bitmap(int width, int height, void *bitmap) +static struct imv_image *to_image(int width, int height, void *bitmap) { struct imv_bitmap *bmp = malloc(sizeof *bmp); bmp->width = width; bmp->height = height; bmp->format = IMV_ABGR; bmp->data = bitmap; - return bmp; + struct imv_image *image = imv_image_create_from_bitmap(bmp); + return image; } static void report_error(struct imv_source *src) @@ -60,7 +61,7 @@ static void report_error(struct imv_source *src) struct imv_source_message msg; msg.source = src; msg.user_data = src->user_data; - msg.bitmap = NULL; + msg.image = NULL; msg.error = "Internal error"; pthread_mutex_unlock(&src->busy); @@ -74,7 +75,7 @@ static void send_bitmap(struct imv_source *src, void *bitmap) struct imv_source_message msg; msg.source = src; msg.user_data = src->user_data; - msg.bitmap = to_imv_bitmap(src->width, src->height, bitmap); + msg.image = to_image(src->width, src->height, bitmap); msg.frametime = 0; msg.error = NULL; @@ -82,11 +83,11 @@ static void send_bitmap(struct imv_source *src, void *bitmap) src->callback(&msg); } -static int load_image(struct imv_source *src) +static void *load_image(struct imv_source *src) { /* Don't run if this source is already active */ if (pthread_mutex_trylock(&src->busy)) { - return -1; + return NULL; } struct private *private = src->private; @@ -98,11 +99,11 @@ static int load_image(struct imv_source *src) if (rcode) { free(bitmap); report_error(src); - return -1; + return NULL; } send_bitmap(src, bitmap); - return 0; + return NULL; } static enum backend_result open_path(const char *path, struct imv_source **src) -- cgit v1.2.3