Skip to content

Commit 7ee6711

Browse files
committed
agx: Move painting the sliders into the functions _setup_purity_slider, _setup_hue_slider.
1 parent d0f9dd5 commit 7ee6711

File tree

1 file changed

+63
-37
lines changed

1 file changed

+63
-37
lines changed

src/iop/agx.c

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,20 +2507,12 @@ static void _paint_slider_gradient(GtkWidget *slider, const float hue_deg, const
25072507
gtk_widget_queue_draw(GTK_WIDGET(slider));
25082508
}
25092509

2510-
static void _paint_hue_slider_hsv(GtkWidget *slider, const float hue_deg, const gboolean reverse)
2511-
{
2512-
_paint_slider_gradient(slider, hue_deg, &_update_hsv_for_hue, reverse);
2513-
}
2514-
2515-
static void _paint_purity_slider_hsv(GtkWidget *slider, const float hue_deg, const gboolean attenuate)
2516-
{
2517-
_paint_slider_gradient(slider, hue_deg, &_update_hsv_for_purity, attenuate);
2518-
}
2519-
25202510
static GtkWidget *_setup_purity_slider(dt_iop_module_t *self,
25212511
const char *param_name,
25222512
const char *tooltip,
2523-
const int primary_index)
2513+
const int primary_index,
2514+
const float hue_deg,
2515+
const gboolean attenuate)
25242516
{
25252517
const float target_primary_value = 0.8f;
25262518
const float other_primaries_value = 0.2;
@@ -2537,10 +2529,17 @@ static GtkWidget *_setup_purity_slider(dt_iop_module_t *self,
25372529

25382530
dt_bauhaus_slider_set_stop(slider, 0.f, r, g, b);
25392531
gtk_widget_set_tooltip_text(slider, tooltip);
2532+
2533+
_paint_slider_gradient(slider, hue_deg, &_update_hsv_for_purity, attenuate);
2534+
25402535
return slider;
25412536
}
25422537

2543-
static GtkWidget *_setup_hue_slider(dt_iop_module_t *self, const char *param_name, const char *tooltip)
2538+
static GtkWidget *_setup_hue_slider(dt_iop_module_t *self,
2539+
const char *param_name,
2540+
const char *tooltip,
2541+
const float hue_deg,
2542+
const gboolean reverse)
25442543
{
25452544
GtkWidget *slider = dt_bauhaus_slider_from_params(self, param_name);
25462545
dt_bauhaus_slider_set_feedback(slider, 0);
@@ -2549,6 +2548,9 @@ static GtkWidget *_setup_hue_slider(dt_iop_module_t *self, const char *param_nam
25492548
dt_bauhaus_slider_set_factor(slider, RAD_2_DEG);
25502549
gtk_widget_set_tooltip_text(slider, tooltip);
25512550
dt_bauhaus_slider_set_default(slider, 0.f);
2551+
2552+
_paint_slider_gradient(slider, hue_deg, &_update_hsv_for_hue, reverse);
2553+
25522554
return slider;
25532555
}
25542556

@@ -2615,29 +2617,41 @@ static void _create_primaries_page(dt_iop_module_t *main,
26152617
slider = _setup_purity_slider(self,
26162618
"red_inset",
26172619
_("increase to desaturate reds in highlights faster"),
2618-
_red_index);
2619-
_paint_purity_slider_hsv(slider, red_hue, TRUE);
2620+
_red_index,
2621+
red_hue,
2622+
TRUE);
26202623

2621-
slider = _setup_hue_slider(self, "red_rotation", _("shift the red primary towards yellow (+) or magenta (-)"));
2622-
_paint_hue_slider_hsv(slider, red_hue, FALSE);
2624+
slider = _setup_hue_slider(self,
2625+
"red_rotation",
2626+
_("shift the red primary towards yellow (+) or magenta (-)"),
2627+
red_hue,
2628+
FALSE);
26232629

26242630
slider = _setup_purity_slider(self,
26252631
"green_inset",
26262632
_("increase to desaturate greens in highlights faster"),
2627-
_green_index);
2628-
_paint_purity_slider_hsv(slider, green_hue, TRUE);
2633+
_green_index,
2634+
green_hue,
2635+
TRUE);
26292636

2630-
slider = _setup_hue_slider(self, "green_rotation", _("shift the green primary towards cyan (+) or yellow (-)"));
2631-
_paint_hue_slider_hsv(slider, green_hue, FALSE);
2637+
slider = _setup_hue_slider(self,
2638+
"green_rotation",
2639+
_("shift the green primary towards cyan (+) or yellow (-)"),
2640+
green_hue,
2641+
FALSE);
26322642

26332643
slider = _setup_purity_slider(self,
26342644
"blue_inset",
26352645
_("increase to desaturate blues in highlights faster"),
2636-
_blue_index);
2637-
_paint_purity_slider_hsv(slider, blue_hue, TRUE);
2646+
_blue_index,
2647+
blue_hue,
2648+
TRUE);
26382649

2639-
slider = _setup_hue_slider(self, "blue_rotation", _("shift the blue primary towards magenta (+) or cyan (-)"));
2640-
_paint_hue_slider_hsv(slider, blue_hue, FALSE);
2650+
slider = _setup_hue_slider(self,
2651+
"blue_rotation",
2652+
_("shift the blue primary towards magenta (+) or cyan (-)"),
2653+
blue_hue,
2654+
FALSE);
26412655

26422656
GtkWidget *reversal_hbox = dt_gui_hbox();
26432657
g->post_curve_primaries_controls_vbox = dt_gui_vbox();
@@ -2677,29 +2691,41 @@ static void _create_primaries_page(dt_iop_module_t *main,
26772691
slider = _setup_purity_slider(self,
26782692
"red_outset",
26792693
_("restore the purity of red, mostly in midtones and shadows"),
2680-
_red_index);
2681-
_paint_purity_slider_hsv(slider, red_hue, FALSE);
2694+
_red_index,
2695+
red_hue,
2696+
FALSE);
26822697

2683-
slider = _setup_hue_slider(self, "red_unrotation", _("reverse the color shift in reds"));
2684-
_paint_hue_slider_hsv(slider, red_hue, TRUE);
2698+
slider = _setup_hue_slider(self,
2699+
"red_unrotation",
2700+
_("reverse the color shift in reds"),
2701+
red_hue,
2702+
TRUE);
26852703

26862704
slider = _setup_purity_slider(self,
26872705
"green_outset",
26882706
_("restore the purity of green, mostly in midtones and shadows"),
2689-
_green_index);
2690-
_paint_purity_slider_hsv(slider, green_hue, FALSE);
2707+
_green_index,
2708+
green_hue,
2709+
FALSE);
26912710

2692-
slider = _setup_hue_slider(self, "green_unrotation", _("reverse the color shift in greens"));
2693-
_paint_hue_slider_hsv(slider, green_hue, TRUE);
2711+
slider = _setup_hue_slider(self,
2712+
"green_unrotation",
2713+
_("reverse the color shift in greens"),
2714+
green_hue,
2715+
TRUE);
26942716

26952717
slider = _setup_purity_slider(self,
26962718
"blue_outset",
26972719
_("restore the purity of blue, mostly in midtones and shadows"),
2698-
_blue_index);
2699-
_paint_purity_slider_hsv(slider, blue_hue, FALSE);
2700-
2701-
slider = _setup_hue_slider(self, "blue_unrotation", _("reverse the color shift in blues"));
2702-
_paint_hue_slider_hsv(slider, blue_hue, TRUE);
2720+
_blue_index,
2721+
blue_hue,
2722+
FALSE);
2723+
2724+
slider = _setup_hue_slider(self,
2725+
"blue_unrotation",
2726+
_("reverse the color shift in blues"),
2727+
blue_hue,
2728+
TRUE);
27032729
}
27042730

27052731
static void _notebook_page_changed(GtkNotebook *notebook,

0 commit comments

Comments
 (0)