diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2013-11-20 14:34:18 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2013-11-20 14:37:56 +0400 |
commit | 25560a3734a18657518652366fe24ce4574d54ff (patch) | |
tree | 2c650da87541e8286d7599e72167e5296673b837 /source/blender/editors/interface/interface_widgets.c | |
parent | d7eac00d12a13876786c9c8b7b409f104dc6ae1d (diff) |
Fix T37545: SV+H color cube display changes H slider position when modifying S or V.
The widget for the SV gradient was disabling display colorspace transform, but this was not happening for the H slider below, leading to varying H values used to calculate the slider position.
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index c26998a7541..97dd4f59ff6 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -2146,6 +2146,19 @@ void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, cons } +bool ui_hsvcube_use_display_colorspace(uiBut *but) +{ + bool color_profile = but->block->color_profile; + + if (but->rnaprop) { + if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) + color_profile = FALSE; + } + + /* SV+H gradient does not use display colorspace */ + return color_profile && !ELEM((int)but->a1, UI_GRAD_SV, UI_GRAD_H); +} + void ui_hsvcube_pos_from_vals(uiBut *but, const rcti *rect, float *hsv, float *xp, float *yp) { float x, y; @@ -2182,16 +2195,13 @@ static void ui_draw_but_HSVCUBE(uiBut *but, const rcti *rect) float x = 0.0f, y = 0.0f; float *hsv = ui_block_hsv_get(but->block); float hsv_n[3]; - int color_profile = but->block->color_profile; - - if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) - color_profile = FALSE; + bool use_display_colorspace = ui_hsvcube_use_display_colorspace(but); copy_v3_v3(hsv_n, hsv); ui_get_but_vectorf(but, rgb); - if (color_profile && (int)but->a1 != UI_GRAD_SV) + if (use_display_colorspace) ui_block_to_display_space_v3(but->block, rgb); rgb_to_hsv_compat_v(rgb, hsv_n); |