[Bf-blender-cvs] [d98ec043412] master: Fix incorrect drawing of material list outline, after recent changes.

Brecht Van Lommel noreply at git.blender.org
Thu Jan 3 15:40:43 CET 2019


Commit: d98ec04341260d1f2e5967105013472d85f7af5d
Author: Brecht Van Lommel
Date:   Thu Jan 3 15:38:22 2019 +0100
Branches: master
https://developer.blender.org/rBd98ec04341260d1f2e5967105013472d85f7af5d

Fix incorrect drawing of material list outline, after recent changes.

For draw cache flushing the default blend mode needs to be set.

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

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 a077a91a4b9..b9202f26a05 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1307,9 +1307,6 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
 		rect = ima->rect;
 	}
 
-	/* We need to flush widget base first to ensure correct ordering. */
-	UI_widgetbase_draw_cache_flush();
-
 	/* draw */
 	GPUBuiltinShader shader;
 	if (desaturate != 0.0f) {
@@ -1513,17 +1510,15 @@ static void icon_draw_size(
 
 	DrawInfo *di = icon_ensure_drawinfo(icon);
 
+	/* We need to flush widget base first to ensure correct ordering. */
+	UI_widgetbase_draw_cache_flush();
+
 	if (di->type == ICON_TYPE_VECTOR) {
-		/* We need to flush widget base first to ensure correct ordering. */
-		UI_widgetbase_draw_cache_flush();
 		/* vector icons use the uiBlock transformation, they are not drawn
 		 * with untransformed coordinates like the other icons */
 		di->data.vector.func((int)x, (int)y, w, h, 1.0f);
 	}
 	else if (di->type == ICON_TYPE_GEOM) {
-		/* We need to flush widget base first to ensure correct ordering. */
-		UI_widgetbase_draw_cache_flush();
-
 #ifdef USE_UI_TOOLBAR_HACK
 		/* TODO(campbell): scale icons up for toolbar, we need a way to detect larger buttons and do this automatic. */
 		{
@@ -1547,7 +1542,8 @@ static void icon_draw_size(
 			ibuf = BKE_icon_geom_rasterize(icon->obj, w, h);
 			di->data.geom.image_cache = ibuf;
 		}
-		glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+
+		GPU_blend_set_func_separate(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
 		icon_draw_rect(x, y, w, h, aspect, w, h, ibuf->rect, alpha, rgb, desaturate);
 		GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
 	}
@@ -1591,9 +1587,7 @@ static void icon_draw_size(
 #endif
 		if (!iimg->rect) return;  /* something has gone wrong! */
 
-		GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
 		icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, iimg->rect, alpha, rgb, desaturate);
-		GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
 	}
 	else if (di->type == ICON_TYPE_PREVIEW) {
 		PreviewImage *pi = (icon->id_type != 0) ? BKE_previewimg_id_ensure((ID *)icon->obj) : icon->obj;
@@ -1611,9 +1605,6 @@ static void icon_draw_size(
 	else if (di->type == ICON_TYPE_GPLAYER) {
 		BLI_assert(icon->obj != NULL);
 
-		/* We need to flush widget base first to ensure correct ordering. */
-		UI_widgetbase_draw_cache_flush();
-
 		/* Just draw a colored rect - Like for vicon_colorset_draw() */
 #ifndef WITH_HEADLESS
 		vicon_gplayer_color_draw(icon, (int)x, (int)y,  w, h);



More information about the Bf-blender-cvs mailing list