aboutsummaryrefslogtreecommitdiff
path: root/src/backend_libtiff.c
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2019-06-15 14:28:29 +0100
committerHarry Jeffery <harry@exec64.co.uk>2019-07-03 20:50:19 +0100
commit7c7dc660e587eac1aa3c8b3405eba95ba558e682 (patch)
tree81d12d560b60d397be23c7d132e32a5de30e409a /src/backend_libtiff.c
parent20e9d23b82f55a751c3cf1166cb59ef26775ee00 (diff)
downloadimv-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_libtiff.c')
-rw-r--r--src/backend_libtiff.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/backend_libtiff.c b/src/backend_libtiff.c
index 482a80b..a3cbb7c 100644
--- a/src/backend_libtiff.c
+++ b/src/backend_libtiff.c
@@ -79,14 +79,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)
@@ -96,7 +97,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);
@@ -110,7 +111,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;
@@ -118,11 +119,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;
@@ -140,11 +141,11 @@ static int load_image(struct imv_source *src)
if (rcode != 1) {
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)