[Bf-blender-cvs] [78918e7] master: Fix T44814: 'preview' icons would not greyout.

Bastien Montagne noreply at git.blender.org
Sun May 24 18:36:27 CEST 2015


Commit: 78918e761f8b54f08d4e1137b5340d850db7e9bc
Author: Bastien Montagne
Date:   Sun May 24 18:35:14 2015 +0200
Branches: master
https://developer.blender.org/rB78918e761f8b54f08d4e1137b5340d850db7e9bc

Fix T44814: 'preview' icons would not greyout.

Since they are premultiplied, we need separated handling of colors and alpha blending
if we want additional alpha factor to work OK.

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

M	source/blender/editors/interface/interface_icons.c

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

diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 420af1e..efd91b9 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1224,15 +1224,12 @@ static void icon_draw_size(
 		PreviewImage *pi = (icon->type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) : icon->obj;
 
 		if (pi) {
-			/* Do deferred loading/generation if needed. */
-//			BKE_previewimg_ensure(pi, size);
-
 			/* no create icon on this level in code */
 			if (!pi->rect[size]) return;  /* something has gone wrong! */
 			
 			/* preview images use premul alpha ... */
-			glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
-			icon_draw_rect(x, y, w, h, aspect, pi->w[size], pi->h[size], pi->rect[size], 1.0f, NULL, is_preview);
+			glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+			icon_draw_rect(x, y, w, h, aspect, pi->w[size], pi->h[size], pi->rect[size], alpha, rgb, is_preview);
 			glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 		}
 	}




More information about the Bf-blender-cvs mailing list