fix for remaining glitch in square color picker, the backdrop could change color because rgb_to_hsv() was used rather then rgb_to_hsv_compat()

This commit is contained in:
Campbell Barton 2010-10-13 14:10:42 +00:00
parent 843d8859a7
commit bbc8cf9d24
3 changed files with 11 additions and 8 deletions

@ -1404,7 +1404,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
if (but->a1 != -1) {
if (but->a1 == UI_GRAD_H) {
rcti grid;
float col[3];
float col[3]= {0.0f, 0.0f, 0.0f}; /* dummy arg */
grid.xmin = rect->xmin + zoomx*(-offsx);
grid.xmax = rect->xmax + zoomx*(-offsx);

@ -444,7 +444,7 @@ extern void ui_draw_aligned_panel(struct ARegion *ar, struct uiStyle *style, uiB
/* interface_draw.c */
extern void ui_dropshadow(rctf *rct, float radius, float aspect, int select);
void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha);
void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha);
void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);

@ -1725,16 +1725,14 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* ************ custom buttons, old stuff ************** */
/* draws in resolution of 20x4 colors */
void ui_draw_gradient(rcti *rect, float *rgb, int type, float alpha)
void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha)
{
int a;
float h, s, v;
float h= hsv[0], s= hsv[1], v= hsv[0];
float dx, dy, sx1, sx2, sy;
float col0[4][3]; // left half, rect bottom to top
float col1[4][3]; // right half, rect bottom to top
rgb_to_hsv(rgb[0], rgb[1], rgb[2], &h, &s, &v);
/* draw series of gouraud rects */
glShadeModel(GL_SMOOTH);
@ -1860,6 +1858,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
float rgb[3], h,s,v;
float x=0.0f, y=0.0f;
float *hsv= ui_block_hsv_get(but->block);
float hsvn[3];
h= hsv[0];
s= hsv[1];
@ -1867,8 +1866,12 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect)
ui_get_but_vectorf(but, rgb);
rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], &h, &s, &v);
hsvn[0]= h;
hsvn[1]= s;
hsvn[2]= v;
ui_draw_gradient(rect, rgb, but->a1, 1.f);
ui_draw_gradient(rect, hsvn, but->a1, 1.f);
switch((int)but->a1) {
case UI_GRAD_SV: