diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-08 14:28:14 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-08 20:45:59 +0300 |
commit | 192a99f47784277baa9eab4864bae1b4382b243c (patch) | |
tree | 948c25b39192a9f21db99d0e67a1b1b3e415933e /source/blender/editors/interface/interface_icons.c | |
parent | 14d0aa728a41b73d150aa6bad88f014e9e7ff348 (diff) |
Fix incorrect alpha blending for icon drawing outside buttons.
This was not so noticeable for old icons with black outline, but with
white outline it's problematic.
Diffstat (limited to 'source/blender/editors/interface/interface_icons.c')
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index fb8c6ec4c56..64f3a8a31d8 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1358,6 +1358,7 @@ void UI_icon_draw_cache_end(void) return; GPU_blend(true); + GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); icon_draw_cache_flush_ex(); @@ -1405,9 +1406,10 @@ static void icon_draw_texture( } /* We need to flush widget base first to ensure correct ordering. */ - GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); UI_widgetbase_draw_cache_flush(); + GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); + float x1, x2, y1, y2; x1 = ix * icongltex.invw; @@ -1431,6 +1433,8 @@ static void icon_draw_texture( GPU_draw_primitive(GPU_PRIM_TRI_STRIP, 4); glBindTexture(GL_TEXTURE_2D, 0); + + GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); } /* Drawing size for preview images */ @@ -1518,10 +1522,8 @@ static void icon_draw_size( } else if (di->type == ICON_TYPE_TEXTURE) { /* texture image use premul alpha for correct scaling */ - GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); icon_draw_texture(x, y, (float)w, (float)h, di->data.texture.x, di->data.texture.y, di->data.texture.w, di->data.texture.h, alpha, rgb); - 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_MONO_TEXTURE) { /* icon that matches text color, assumed to be white */ @@ -1539,10 +1541,8 @@ static void icon_draw_size( mul_v4_fl(color, alpha); - GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); icon_draw_texture(x, y, (float)w, (float)h, di->data.texture.x, di->data.texture.y, di->data.texture.w, di->data.texture.h, color[3], color); - 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_BUFFER) { |