Commit: a2df2a637e83cef856074b886055eccbc04ae052
Author: Antony Riakiotakis
Date:   Sun Apr 27 23:38:21 2014 +0300
https://developer.blender.org/rBa2df2a637e83cef856074b886055eccbc04ae052

Two changes:

* Buffer icons are usually in straight space (since we load from pngs)
so use src_alpha in OpenGL for blending.

* Allow blending for preview icons. This will be useful for the next
commit...

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

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

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

diff --git a/source/blender/editors/interface/interface_icons.c 
b/source/blender/editors/interface/interface_icons.c
index f580bd6..cbbb6a2 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1137,7 +1137,7 @@ static void icon_draw_size(float x, float y, int icon_id, 
float aspect, float al
 #endif
                if (!iimg->rect) return;  /* something has gone wrong! */
 
-               glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+               glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                icon_draw_rect(x, y, w, h, aspect, iimg->w, iimg->h, 
iimg->rect, alpha, rgb, is_preview);
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        }
diff --git a/source/blender/editors/interface/interface_widgets.c 
b/source/blender/editors/interface/interface_widgets.c
index 4d2bd18..30db16e 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -851,7 +851,9 @@ static void widget_draw_icon(const uiBut *but, BIFIconID 
icon, float alpha, cons
        float aspect, height;
        
        if (but->flag & UI_ICON_PREVIEW) {
+               glEnable(GL_BLEND);
                widget_draw_preview(icon, alpha, rect);
+               glDisable(GL_BLEND);
                return;
        }
        
@@ -3753,6 +3755,7 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti 
*rect, const char *name, int
        wt->state(wt, state);
        wt->draw(&wt->wcol, rect, 0, 0);
        
+       glEnable(GL_BLEND);
        widget_draw_preview(iconid, 1.0f, rect);
        
        BLF_width_and_height(fstyle->uifont_id, name, BLF_DRAW_STR_DUMMY_MAX, 
&font_dims[0], &font_dims[1]);
@@ -3775,7 +3778,6 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti 
*rect, const char *name, int
                bg_rect.xmax = rect->xmax - PREVIEW_PAD;
 
        glColor4ubv((unsigned char *)wt->wcol_theme->inner_sel);
-       glEnable(GL_BLEND);
        glRecti(bg_rect.xmin, bg_rect.ymin, bg_rect.xmax, bg_rect.ymax);
        glDisable(GL_BLEND);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to