Skip to content

Commit

Permalink
hsv knobs: also catch case where colourfulness drops to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
hanatos committed Nov 3, 2024
1 parent ce0cce7 commit 90154a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ static inline struct nk_colorf
rgb2hsv_prior(float r, float g, float b, struct nk_colorf hsv_prior)
{
if(r <= 0 && g <= 0 && b <= 0) return (struct nk_colorf){hsv_prior.r, hsv_prior.g, 0.0, 1.0};
return rgb2hsv(r, g, b);
struct nk_colorf res = rgb2hsv(r, g, b);
if(res.g <= 1e-5) res.r = hsv_prior.r;
return res;
}

static inline struct nk_colorf
Expand Down
3 changes: 2 additions & 1 deletion src/gui/render_darkroom.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ render_darkroom_widget(int modid, int parid, int is_fav_menu)
nk_label(ctx, str, NK_TEXT_LEFT);
if(change)
{
cc_hsv[hash] = hsv;
if(hsv.g > 0.0 && hsv.b > 0.0) cc_hsv[hash] = hsv;
else cc_hsv[hash] = (struct nk_colorf){cc_hsv[hash].r, hsv.g, hsv.b};
dt_graph_run_t flags = s_graph_run_none;
if(vkdt.graph_dev.module[modid].so->check_params)
flags = vkdt.graph_dev.module[modid].so->check_params(vkdt.graph_dev.module+modid, parid, num, &oldval);
Expand Down

0 comments on commit 90154a5

Please sign in to comment.