From 59b108498a5c45b3fbab4fed5bfe55881e9ef1ad Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 14 Aug 2016 22:26:37 +0100 Subject: fix bitmap modification callback calling for bmp image handler bitmap file decoding is done at first call to redraw but was not calling the modified callback at the correct time immediately after decode so frontend image chnages were not being done. This caused nsgtk to fail to apply its colour space fixups so red was swapped with blue. --- content/handlers/image/bmp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'content/handlers/image') diff --git a/content/handlers/image/bmp.c b/content/handlers/image/bmp.c index e552cdf94..5970f8b16 100644 --- a/content/handlers/image/bmp.c +++ b/content/handlers/image/bmp.c @@ -166,7 +166,6 @@ static bool nsbmp_convert(struct content *c) /* exit as a success */ bmp->bitmap = bmp->bmp->bitmap; - guit->bitmap->modified(bmp->bitmap); content_set_ready(c); content_set_done(c); @@ -182,11 +181,18 @@ static bool nsbmp_redraw(struct content *c, struct content_redraw_data *data, nsbmp_content *bmp = (nsbmp_content *) c; bitmap_flags_t flags = BITMAPF_NONE; - if (bmp->bmp->decoded == false) - if (bmp_decode(bmp->bmp) != BMP_OK) + if (bmp->bmp->decoded == false) { + bmp_result res; + res = bmp_decode(bmp->bmp); + /* allow short or incomplete image data giving a partial image*/ + if ((res != BMP_OK) && + (res != BMP_INSUFFICIENT_DATA) && + (res != BMP_DATA_ERROR)) { return false; + } - bmp->bitmap = bmp->bmp->bitmap; + guit->bitmap->modified(bmp->bitmap); + } if (data->repeat_x) flags |= BITMAPF_REPEAT_X; -- cgit v1.2.3