@@ -1407,15 +1407,15 @@ static void _update_pivot_x(const float old_black_ev, const float old_white_ev,
14071407 {
14081408 darktable .gui -> reset ++ ;
14091409 GtkWidget * slider = g -> basic_curve_controls .curve_pivot_x ;
1410-
1410+ dt_bauhaus_slider_set ( slider , p -> curve_pivot_x );
14111411 dt_bauhaus_slider_set_factor (slider , new_range );
14121412 dt_bauhaus_slider_set_offset (slider , new_black_ev );
14131413 darktable .gui -> reset -- ;
14141414 } else
14151415 {
14161416 printf ("@@@ kofa _update_pivot_x, g is NULL\n" );
14171417 }
1418- dt_dev_add_history_item (darktable .develop , self , TRUE);
1418+ // dt_dev_add_history_item(darktable.develop, self, TRUE);
14191419 printf ("@@@ kofa _update_pivot_x end\n" );
14201420}
14211421
@@ -1494,7 +1494,6 @@ static void _agx_tone_mapping(dt_aligned_pixel_t rgb_in_out,
14941494static void _apply_auto_black_exposure (const dt_iop_module_t * self )
14951495{
14961496 printf ("@@@ kofa _apply_auto_black_exposure start\n" );
1497- // if(darktable.gui->reset) return;
14981497
14991498 dt_iop_agx_params_t * p = self -> params ;
15001499 const dt_iop_agx_gui_data_t * g = self -> gui_data ;
@@ -1517,7 +1516,7 @@ static void _apply_auto_black_exposure(const dt_iop_module_t *self)
15171516static void _apply_auto_white_exposure (const dt_iop_module_t * self )
15181517{
15191518 printf ("@@@ kofa _apply_auto_white_exposure start\n" );
1520- // if(darktable.gui->reset) return;
1519+ if (darktable .gui -> reset ) return ;
15211520
15221521 dt_iop_agx_params_t * p = self -> params ;
15231522 const dt_iop_agx_gui_data_t * g = self -> gui_data ;
@@ -1540,7 +1539,6 @@ static void _apply_auto_white_exposure(const dt_iop_module_t *self)
15401539static void _apply_auto_tune_exposure (const dt_iop_module_t * self )
15411540{
15421541 printf ("@@@ kofa _apply_auto_tune_exposure start\n" );
1543- // if(darktable.gui->reset) return;
15441542
15451543 dt_iop_agx_params_t * p = self -> params ;
15461544 const dt_iop_agx_gui_data_t * g = self -> gui_data ;
@@ -1587,8 +1585,6 @@ static void _apply_auto_pivot_xy(dt_iop_module_t *self, const dt_iop_order_iccpr
15871585{
15881586 printf ("@@@ kofa _apply_auto_pivot_xy start\n" );
15891587
1590- // if(darktable.gui->reset) return;
1591-
15921588 dt_iop_agx_params_t * p = self -> params ;
15931589 const dt_iop_agx_gui_data_t * g = self -> gui_data ;
15941590
@@ -1597,17 +1593,18 @@ static void _apply_auto_pivot_xy(dt_iop_module_t *self, const dt_iop_order_iccpr
15971593 const float picked_ev = CLAMPF (log2f (fmaxf (_epsilon , picked_input_luminance ) / 0.18f ),
15981594 p -> range_black_relative_ev ,
15991595 p -> range_white_relative_ev );
1596+ const float range = p -> range_white_relative_ev - p -> range_black_relative_ev ;
1597+ const float picked_pivot_x = (picked_ev - p -> range_black_relative_ev ) / range ;
16001598
16011599 const tone_mapping_params_t tone_mapping_params =
16021600 _calculate_tone_mapping_params (p );
16031601
16041602 // see where the target_pivot is currently mapped
1605- const float target_y = _apply_curve (p -> curve_pivot_x , & tone_mapping_params );
1603+ const float target_y = _apply_curve (picked_pivot_x , & tone_mapping_params );
16061604 // try to avoid changing the brightness of the pivot
16071605 const float target_y_linearised = powf (target_y , p -> curve_gamma );
16081606 p -> curve_pivot_y_linear_output = target_y_linearised ;
1609- const float range = p -> range_white_relative_ev - p -> range_black_relative_ev ;
1610- p -> curve_pivot_x = (picked_ev - p -> range_black_relative_ev ) / range ;
1607+ p -> curve_pivot_x = picked_pivot_x ;
16111608
16121609 ++ darktable .gui -> reset ;
16131610 dt_bauhaus_slider_set (g -> basic_curve_controls .curve_pivot_x ,
@@ -1623,8 +1620,6 @@ static void _apply_auto_pivot_x(dt_iop_module_t *self, const dt_iop_order_iccpro
16231620{
16241621 printf ("@@@ kofa _apply_auto_pivot_x start\n" );
16251622
1626- // if(darktable.gui->reset) return;
1627-
16281623 dt_iop_agx_params_t * p = self -> params ;
16291624 const dt_iop_agx_gui_data_t * g = self -> gui_data ;
16301625
@@ -3077,6 +3072,8 @@ void color_picker_apply(dt_iop_module_t *self,
30773072 GtkWidget * picker ,
30783073 dt_dev_pixelpipe_t * pipe )
30793074{
3075+ if (darktable .gui -> reset ) return ;
3076+
30803077 printf ("@@@ kofa color_picker_apply start\n" );
30813078 dt_iop_agx_params_t * p = self -> params ;
30823079 const dt_iop_agx_gui_data_t * g = self -> gui_data ;
@@ -3090,6 +3087,8 @@ void color_picker_apply(dt_iop_module_t *self,
30903087 else if (picker == g -> basic_curve_controls .curve_pivot_x ) _apply_auto_pivot_x (self , dt_ioppr_get_pipe_work_profile_info (pipe ));
30913088 else if (picker == g -> basic_curve_controls .curve_pivot_y_linear ) _apply_auto_pivot_xy (self , dt_ioppr_get_pipe_work_profile_info (pipe ));
30923089
3090+ _update_pivot_x (old_black_ev , old_white_ev , self , p );
3091+
30933092 if (p -> auto_gamma )
30943093 {
30953094 ++ darktable .gui -> reset ;
@@ -3099,11 +3098,9 @@ void color_picker_apply(dt_iop_module_t *self,
30993098 dt_bauhaus_slider_set (g -> curve_gamma , tone_mapping_params .curve_gamma );
31003099 -- darktable .gui -> reset ;
31013100 }
3102- _update_pivot_x (old_black_ev , old_white_ev , self , p );
31033101
31043102 _update_curve_warnings (self );
31053103 gtk_widget_queue_draw (GTK_WIDGET (g -> graph_drawing_area ));
3106- dt_iop_gui_update (self );
31073104 dt_dev_add_history_item (darktable .develop , self , TRUE);
31083105 printf ("@@@ kofa color_picker_apply end\n" );
31093106}
0 commit comments