From 0066e337683c9b78ff3a62e1caed004d07fe4803 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Wed, 25 Aug 2010 07:49:12 +0000 Subject: Fix: Colour picker wheel wasn't gamma corrected - drawing too dark --- source/blender/editors/interface/interface_widgets.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 6b7d88d3c28..32ede75c20d 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1638,6 +1638,10 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) float centx, centy, radius; float rgb[3], hsv[3], hsvo[3], col[3], colcent[3]; int a, tot= 32; + int color_profile = but->block->color_profile; + + if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) + color_profile = BLI_PR_NONE; radstep= 2.0f*M_PI/(float)tot; centx= (float)(rect->xmin + rect->xmax)/2; @@ -1656,7 +1660,10 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* exception: if 'lock' is set * lock the value of the color wheel to 1. * Useful for color correction tools where you're only interested in hue. */ - if (but->flag & UI_BUT_COLOR_LOCK) hsv[2] = 1.f; + if (but->flag & UI_BUT_COLOR_LOCK) + hsv[2] = 1.f; + else if (color_profile) + hsv[2] = linearrgb_to_srgb(hsv[2]); hsv_to_rgb(0.f, 0.f, hsv[2], colcent, colcent+1, colcent+2); @@ -1884,11 +1891,8 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) float rgb[3], hsv[3], v, range; int color_profile = but->block->color_profile; - if (but->rnaprop) { - if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) { - color_profile = BLI_PR_NONE; - } - } + if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) + color_profile = BLI_PR_NONE; ui_get_but_vectorf(but, rgb); rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); -- cgit v1.2.3