Fix #29670: color picker draw issues with RGB values out of soft range.

This commit is contained in:
Brecht Van Lommel 2011-12-21 13:49:22 +00:00
parent 1dd72692cd
commit 99e6e6cc08
3 changed files with 6 additions and 6 deletions

@ -1901,7 +1901,7 @@ void ui_set_but_soft_range(uiBut *but, double value)
if(softmin < (double)but->hardmin) if(softmin < (double)but->hardmin)
softmin= (double)but->hardmin; softmin= (double)but->hardmin;
} }
else if(value_max-1e-10 > softmax) { if(value_max-1e-10 > softmax) {
if(value_max < 0.0) if(value_max < 0.0)
softmax= -soft_range_round_down(-value_max, -softmax); softmax= -soft_range_round_down(-value_max, -softmax);
else else

@ -5247,7 +5247,7 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
highlight when not in a popup menu, we remove because data used in highlight when not in a popup menu, we remove because data used in
button below popup might have been removed by action of popup. Needs button below popup might have been removed by action of popup. Needs
a more reliable solution... */ a more reliable solution... */
if(state != BUTTON_STATE_HIGHLIGHT || but->block->handle) if(state != BUTTON_STATE_HIGHLIGHT || (but->block->flag & UI_BLOCK_LOOP))
ui_check_but(but); ui_check_but(but);
} }

@ -1795,7 +1795,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
{ {
/* gouraud triangle fan */ /* gouraud triangle fan */
float radstep, ang= 0.0f; float radstep, ang= 0.0f;
float centx, centy, radius; float centx, centy, radius, cursor_radius;
float rgb[3], hsvo[3], hsv[3], col[3], colcent[3]; float rgb[3], hsvo[3], hsv[3], col[3], colcent[3];
int a, tot= 32; int a, tot= 32;
int color_profile = but->block->color_profile; int color_profile = but->block->color_profile;
@ -1864,12 +1864,12 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI; ang= 2.0f*(float)M_PI*hsvo[0] + 0.5f*(float)M_PI;
if(but->flag & UI_BUT_COLOR_CUBIC) if(but->flag & UI_BUT_COLOR_CUBIC)
radius= (1.0f - powf(1.0f - hsvo[1], 3.0f)) *radius; cursor_radius = (1.0f - powf(1.0f - hsvo[1], 3.0f));
else else
radius= hsvo[1] * radius; cursor_radius = hsvo[1];
radius= CLAMPIS(cursor_radius, 0.0f, 1.0f) * radius;
ui_hsv_cursor(centx + cosf(-ang)*radius, centy + sinf(-ang)*radius); ui_hsv_cursor(centx + cosf(-ang)*radius, centy + sinf(-ang)*radius);
} }
/* ************ custom buttons, old stuff ************** */ /* ************ custom buttons, old stuff ************** */