Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2014-04-28 00:38:21 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-04-28 00:38:39 +0400
commita2df2a637e83cef856074b886055eccbc04ae052 (patch)
treec800c98e038846daac1aef5d22e837707b3fefe7
parentf328f45e22abafbb4eb88fc441c9b3707624901f (diff)
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...
-rw-r--r--source/blender/editors/interface/interface_icons.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index f580bd6b5f2..cbbb6a2a255 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 4d2bd186f56..30db16e0d82 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);