From 3e1523d6a7c83d74673f5106ff87f7da465f467c Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Thu, 10 Dec 2015 15:26:01 +0000 Subject: Make imv_loader_get_image more informative --- src/loader.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/loader.c') diff --git a/src/loader.c b/src/loader.c index 97ba8e4..22ed9be 100644 --- a/src/loader.c +++ b/src/loader.c @@ -81,14 +81,17 @@ void imv_loader_load_path(struct imv_loader *ldr, const char *path) pthread_mutex_unlock(&ldr->lock); } -FIBITMAP *imv_loader_get_image(struct imv_loader *ldr) +int imv_loader_get_image(struct imv_loader *ldr, FIBITMAP **out_bmp, + int *out_is_new_image) { - FIBITMAP *ret = NULL; + int ret = 0; pthread_mutex_lock(&ldr->lock); if(ldr->out_bmp) { - ret = ldr->out_bmp; + *out_bmp = ldr->out_bmp; ldr->out_bmp = NULL; + *out_is_new_image = ldr->out_is_new_image; + ret = 1; } pthread_mutex_unlock(&ldr->lock); @@ -250,6 +253,7 @@ static void *imv_loader_bg_new_img(void *data) FreeImage_Unload(ldr->out_bmp); } ldr->out_bmp = FreeImage_Clone(bmp); + ldr->out_is_new_image = 1; ldr->width = width; ldr->height = height; ldr->cur_frame = 0; @@ -364,6 +368,7 @@ static void *imv_loader_bg_next_frame(void *data) FreeImage_Unload(ldr->out_bmp); } ldr->out_bmp = FreeImage_Clone(ldr->bmp); + ldr->out_is_new_image = 0; pthread_mutex_unlock(&ldr->lock); return 0; -- cgit v1.2.3