[Bf-blender-cvs] [3252773] ui-preview-buttons: Fix bad alpha - PreviewImage are assumed to be premultiplied...

Bastien Montagne noreply at git.blender.org
Sat May 9 12:38:25 CEST 2015


Commit: 325277383aa1f8d20518bbd1cb65283dc7682c36
Author: Bastien Montagne
Date:   Sat May 9 12:29:18 2015 +0200
Branches: ui-preview-buttons
https://developer.blender.org/rB325277383aa1f8d20518bbd1cb65283dc7682c36

Fix bad alpha - PreviewImage are assumed to be premultiplied...

===================================================================

M	source/blender/blenkernel/intern/icons.c
M	source/blender/editors/render/render_preview.c

===================================================================

diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index 3f6dce8..7963ca3 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -392,6 +392,9 @@ void BKE_previewimg_ensure(PreviewImage *prv, const int size)
 			thumb = IMB_thumb_manage(path, THB_LARGE, source);
 
 			if (thumb) {
+				/* PreviewImage assumes premultiplied alhpa... */
+				IMB_premultiply_alpha(thumb);
+
 				if (do_preview) {
 					prv->w[ICON_SIZE_PREVIEW] = thumb->x;
 					prv->h[ICON_SIZE_PREVIEW] = thumb->y;
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index d70228a..f3302a9 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -947,6 +947,9 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
 		thumb = IMB_thumb_manage(path, THB_LARGE, source);
 
 		if (thumb) {
+			/* PreviewImage assumes premultiplied alhpa... */
+			IMB_premultiply_alpha(thumb);
+
 			icon_copy_rect(thumb, sp->sizex, sp->sizey, sp->pr_rect);
 			IMB_freeImBuf(thumb);
 		}




More information about the Bf-blender-cvs mailing list