UI: optionally pass icon size to widget_draw_icon

No functional changes.
This commit is contained in:
Campbell Barton 2018-04-25 17:24:45 +02:00
parent 89bcc80c25
commit f69feb4957
1 changed files with 10 additions and 4 deletions

View File

@ -868,9 +868,9 @@ static int ui_but_draw_menu_icon(const uiBut *but)
/* icons have been standardized... and this call draws in untransformed coordinates */
static void widget_draw_icon(
const uiBut *but, BIFIconID icon, float alpha, const rcti *rect,
const bool show_menu_icon)
static void widget_draw_icon_ex(
const uiBut *but, BIFIconID icon, float alpha, const rcti *rect, const bool show_menu_icon,
const int icon_size)
{
float xs = 0.0f, ys = 0.0f;
float aspect, height;
@ -886,7 +886,7 @@ static void widget_draw_icon(
if (icon == ICON_BLANK1 && (but->flag & UI_BUT_ICON_SUBMENU) == 0) return;
aspect = but->block->aspect / UI_DPI_FAC;
height = ICON_DEFAULT_HEIGHT / aspect;
height = icon_size / aspect;
/* calculate blend color */
if (ELEM(but->type, UI_BTYPE_TOGGLE, UI_BTYPE_ROW, UI_BTYPE_TOGGLE_N, UI_BTYPE_LISTROW)) {
@ -950,6 +950,12 @@ static void widget_draw_icon(
glDisable(GL_BLEND);
}
static void widget_draw_icon(
const uiBut *but, BIFIconID icon, float alpha, const rcti *rect, const bool show_menu_icon)
{
widget_draw_icon_ex(but, icon, alpha, rect, show_menu_icon, ICON_DEFAULT_HEIGHT);
}
static void ui_text_clip_give_prev_off(uiBut *but, const char *str)
{
const char *prev_utf8 = BLI_str_find_prev_char_utf8(str, str + but->ofs);