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...
This commit is contained in:
Antony Riakiotakis
2014-04-27 23:38:21 +03:00
parent f328f45e22
commit a2df2a637e
2 changed files with 4 additions and 2 deletions

View File

@@ -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);
}

View File

@@ -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);