[Bf-blender-cvs] [f69feb49570] master: UI: optionally pass icon size to widget_draw_icon

Campbell Barton noreply at git.blender.org
Wed Apr 25 17:26:52 CEST 2018


Commit: f69feb4957028b2d2d5bba81ef75686d10f03090
Author: Campbell Barton
Date:   Wed Apr 25 17:24:45 2018 +0200
Branches: master
https://developer.blender.org/rBf69feb4957028b2d2d5bba81ef75686d10f03090

UI: optionally pass icon size to widget_draw_icon

No functional changes.

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

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

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

diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 9a1d47e0154..f1f193f1b02 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -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);



More information about the Bf-blender-cvs mailing list