diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-04 13:43:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-04 13:43:27 +0400 |
commit | c872ffd94f1b94f8da725080e53d2e5400cb3a04 (patch) | |
tree | b6665b928faa75dc055f80d7b0cb336e1aec1680 /source/blender/editors/interface | |
parent | 753b627cb6fb92ec1b168c6ea6270eb5115911b7 (diff) |
code cleanup: make the behavior of set_current_material_texture() clearer and remove redundant NULL check there. also small changes to ui_draw_but_HSVCIRCLE().
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 6f819bd0491..aa74ee8e49a 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1903,27 +1903,25 @@ void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rec *val_rad = atan2f(m_delta[0], m_delta[1]) / (2.0f * (float)M_PI) + 0.5f; } -static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) +static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, const rcti *rect) { + const int tot = 32; + const float radstep = 2.0f * (float)M_PI / (float)tot; + + const float centx = BLI_rcti_cent_x_fl(rect); + const float centy = BLI_rcti_cent_y_fl(rect); + float radius = (float)mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)) / 2.0f; + /* gouraud triangle fan */ - float radstep, ang = 0.0f; - float centx, centy, radius, cursor_radius; + float ang = 0.0f; + float cursor_radius; float rgb[3], hsvo[3], hsv[3], col[3], colcent[3]; - int a, tot = 32; + int a; int color_profile = but->block->color_profile; if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) color_profile = FALSE; - radstep = 2.0f * (float)M_PI / (float)tot; - centx = BLI_rcti_cent_x_fl(rect); - centy = BLI_rcti_cent_y_fl(rect); - - if (BLI_rcti_size_x(rect) > BLI_rcti_size_y(rect)) - radius = (float)BLI_rcti_size_y(rect) / 2; - else - radius = (float)BLI_rcti_size_x(rect) / 2; - /* color */ ui_get_but_vectorf(but, rgb); /* copy_v3_v3(hsv, ui_block_hsv_get(but->block)); */ /* UNUSED */ |