summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-08-14 21:26:37 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2016-08-14 21:26:37 (GMT)
commit59b108498a5c45b3fbab4fed5bfe55881e9ef1ad (patch)
tree852dcfd96d023474dce022b37bca1a4616a961a5
parent91f4f89d4c864c6ce0170d60a13a29aed56fea5d (diff)
downloadnetsurf-59b108498a5c45b3fbab4fed5bfe55881e9ef1ad.tar.gz
netsurf-59b108498a5c45b3fbab4fed5bfe55881e9ef1ad.tar.bz2
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.
-rw-r--r--content/handlers/image/bmp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/content/handlers/image/bmp.c b/content/handlers/image/bmp.c
index e552cdf..5970f8b 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;