diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2019-06-15 14:28:29 +0100 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2019-07-03 20:50:19 +0100 |
commit | 7c7dc660e587eac1aa3c8b3405eba95ba558e682 (patch) | |
tree | 81d12d560b60d397be23c7d132e32a5de30e409a /src/backend_libjpeg.c | |
parent | 20e9d23b82f55a751c3cf1166cb59ef26775ee00 (diff) | |
download | imv-7c7dc660e587eac1aa3c8b3405eba95ba558e682.tar.gz |
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.
Diffstat (limited to 'src/backend_libjpeg.c')
-rw-r--r-- | src/backend_libjpeg.c | 17 |
1 files changed, 9 insertions, 8 deletions
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) |