Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2015-07-16 18:26:53 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-07-16 18:28:25 +0300
commitf2087b4830b2f59188e9c604450db5f37b6d472a (patch)
treec5899a1dcc2d33a2a87244e6eda273cd56a65263 /source/blender/imbuf/intern/thumbs.c
parent4feef7d4f8d5f32446bf313b6849c4dad3d61d9d (diff)
Fix T45451: File Browser crash on 16bits PNG image previews.
Issue was that with those files, Blender generate a float image by default, not a byte one... Now, we ensure in two places we only get a byte imbuf for our thumbnails!
Diffstat (limited to 'source/blender/imbuf/intern/thumbs.c')
-rw-r--r--source/blender/imbuf/intern/thumbs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c
index bd7495734d1..09e7d044082 100644
--- a/source/blender/imbuf/intern/thumbs.c
+++ b/source/blender/imbuf/intern/thumbs.c
@@ -442,6 +442,10 @@ static ImBuf *thumb_create_ex(
img->ftype = IMB_FTYPE_PNG;
img->planes = 32;
+ /* If we generated from a 16bit PNG e.g., we have a float rect, not a byte one - fix this. */
+ IMB_rect_from_float(img);
+ imb_freerectfloatImBuf(img);
+
if (IMB_saveiff(img, temp, IB_rect | IB_metadata)) {
#ifndef WIN32
chmod(temp, S_IRUSR | S_IWUSR);
@@ -604,5 +608,11 @@ ImBuf *IMB_thumb_manage(const char *org_path, ThumbSize size, ThumbSource source
}
}
+ /* Our imbuf **must** have a valid rect (i.e. 8-bits/channels) data, we rely on this in draw code.
+ * However, in some cases we may end loading 16bits PNGs, which generated float buffers.
+ * This should be taken care of in generation step, but add also a safeguard here! */
+ IMB_rect_from_float(img);
+ imb_freerectfloatImBuf(img);
+
return img;
}