Skip to content

Commit 9cc90ba

Browse files
jenshannoschwalmTurboGit
authored andcommitted
Unify dt_iop_module_t *self for dt_iop_module_t *module
Just code style unify, as that's not coherently used in the iop/lib modules. 1. If the pointer `dt_iop_module_t *module` is used in the module "itself", it should be `dt_iop_module_t *self` for clarity. 2. We keep `dt_iop_module_t *module` elsewhere. Otherwise a few remaining structs in function parameters, overcastings and formatting.
1 parent 8a7aefa commit 9cc90ba

40 files changed

+689
-693
lines changed

src/iop/ashift.c

Lines changed: 73 additions & 73 deletions
Large diffs are not rendered by default.

src/iop/atrous.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -647,11 +647,11 @@ void tiling_callback(dt_iop_module_t *self,
647647
return;
648648
}
649649

650-
void init(dt_iop_module_t *module)
650+
void init(dt_iop_module_t *self)
651651
{
652-
dt_iop_default_init(module);
652+
dt_iop_default_init(self);
653653

654-
dt_iop_atrous_params_t *d = module->default_params;
654+
dt_iop_atrous_params_t *d = self->default_params;
655655

656656
for(int k = 0; k < BANDS; k++)
657657
{
@@ -661,12 +661,11 @@ void init(dt_iop_module_t *module)
661661
}
662662
}
663663

664-
void init_global(dt_iop_module_so_t *module)
664+
void init_global(dt_iop_module_so_t *self)
665665
{
666666
const int program = 1; // from programs.conf
667-
dt_iop_atrous_global_data_t *gd
668-
= (dt_iop_atrous_global_data_t *)malloc(sizeof(dt_iop_atrous_global_data_t));
669-
module->data = gd;
667+
dt_iop_atrous_global_data_t *gd = malloc(sizeof(dt_iop_atrous_global_data_t));
668+
self->data = gd;
670669
gd->kernel_decompose = dt_opencl_create_kernel(program, "eaw_decompose");
671670
gd->kernel_synthesize = dt_opencl_create_kernel(program, "eaw_synthesize");
672671
#ifdef USE_NEW_CL
@@ -675,22 +674,22 @@ void init_global(dt_iop_module_so_t *module)
675674
#endif
676675
}
677676

678-
void cleanup_global(dt_iop_module_so_t *module)
677+
void cleanup_global(dt_iop_module_so_t *self)
679678
{
680-
dt_iop_atrous_global_data_t *gd = module->data;
679+
dt_iop_atrous_global_data_t *gd = self->data;
681680
dt_opencl_free_kernel(gd->kernel_decompose);
682681
dt_opencl_free_kernel(gd->kernel_synthesize);
683682
#ifdef USE_NEW_CL
684683
dt_opencl_free_kernel(gd->kernel_zero);
685684
dt_opencl_free_kernel(gd->kernel_addbuffers);
686685
#endif
687-
free(module->data);
688-
module->data = NULL;
686+
free(self->data);
687+
self->data = NULL;
689688
}
690689

691690
static inline void _apply_mix(dt_iop_module_t *self,
692-
const int ch
693-
, const int k,
691+
const int ch,
692+
const int k,
694693
const float mix,
695694
const float px,
696695
const float py,

src/iop/basecurve.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -503,15 +503,15 @@ static gboolean _check_camera(dt_iop_basecurve_params_t *d,
503503
return FALSE;
504504
}
505505

506-
void reload_defaults(dt_iop_module_t *module)
506+
void reload_defaults(dt_iop_module_t *self)
507507
{
508-
dt_iop_basecurve_params_t *const d = module->default_params;
508+
dt_iop_basecurve_params_t *const d = self->default_params;
509509

510-
if(module->multi_priority == 0)
510+
if(self->multi_priority == 0)
511511
{
512-
const dt_image_t *const image = &(module->dev->image_storage);
512+
const dt_image_t *const image = &(self->dev->image_storage);
513513

514-
module->default_enabled = FALSE;
514+
self->default_enabled = FALSE;
515515

516516
gboolean FOUND = FALSE;
517517

@@ -1530,19 +1530,19 @@ static float eval_grey(float x)
15301530
return x;
15311531
}
15321532

1533-
void init(dt_iop_module_t *module)
1533+
void init(dt_iop_module_t *self)
15341534
{
1535-
dt_iop_default_init(module);
1536-
dt_iop_basecurve_params_t *d = module->default_params;
1535+
dt_iop_default_init(self);
1536+
dt_iop_basecurve_params_t *d = self->default_params;
15371537
d->basecurve[0][1].x = d->basecurve[0][1].y = 1.0;
15381538
d->basecurve_nodes[0] = 2;
15391539
}
15401540

1541-
void init_global(dt_iop_module_so_t *module)
1541+
void init_global(dt_iop_module_so_t *self)
15421542
{
15431543
const int program = 18; // basecurve.cl, from programs.conf
15441544
dt_iop_basecurve_global_data_t *gd = malloc(sizeof(dt_iop_basecurve_global_data_t));
1545-
module->data = gd;
1545+
self->data = gd;
15461546
gd->kernel_basecurve_lut = dt_opencl_create_kernel(program, "basecurve_lut");
15471547
gd->kernel_basecurve_zero = dt_opencl_create_kernel(program, "basecurve_zero");
15481548
gd->kernel_basecurve_legacy_lut = dt_opencl_create_kernel(program, "basecurve_legacy_lut");
@@ -1560,9 +1560,9 @@ void init_global(dt_iop_module_so_t *module)
15601560
gd->kernel_basecurve_finalize = dt_opencl_create_kernel(program, "basecurve_finalize");
15611561
}
15621562

1563-
void cleanup_global(dt_iop_module_so_t *module)
1563+
void cleanup_global(dt_iop_module_so_t *self)
15641564
{
1565-
dt_iop_basecurve_global_data_t *gd = module->data;
1565+
dt_iop_basecurve_global_data_t *gd = self->data;
15661566
dt_opencl_free_kernel(gd->kernel_basecurve_lut);
15671567
dt_opencl_free_kernel(gd->kernel_basecurve_zero);
15681568
dt_opencl_free_kernel(gd->kernel_basecurve_legacy_lut);
@@ -1578,8 +1578,8 @@ void cleanup_global(dt_iop_module_so_t *module)
15781578
dt_opencl_free_kernel(gd->kernel_basecurve_normalize);
15791579
dt_opencl_free_kernel(gd->kernel_basecurve_reconstruct);
15801580
dt_opencl_free_kernel(gd->kernel_basecurve_finalize);
1581-
free(module->data);
1582-
module->data = NULL;
1581+
free(self->data);
1582+
self->data = NULL;
15831583
}
15841584

15851585
static gboolean dt_iop_basecurve_leave_notify(GtkWidget *widget,

src/iop/cacorrect.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,14 +1218,18 @@ DT_OMP_PRAGMA(barrier)
12181218
/*==================================================================================
12191219
* end raw therapee code
12201220
*==================================================================================*/
1221-
void modify_roi_out(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, dt_iop_roi_t *roi_out,
1221+
void modify_roi_out(dt_iop_module_t *self,
1222+
dt_dev_pixelpipe_iop_t *piece,
1223+
dt_iop_roi_t *roi_out,
12221224
const dt_iop_roi_t *const roi_in)
12231225
{
12241226
*roi_out = *roi_in;
12251227
roi_out->x = MAX(0, roi_in->x);
12261228
roi_out->y = MAX(0, roi_in->y);
12271229
}
1228-
void modify_roi_in(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const dt_iop_roi_t *const roi_out,
1230+
void modify_roi_in(dt_iop_module_t *self,
1231+
dt_dev_pixelpipe_iop_t *piece,
1232+
const dt_iop_roi_t *const roi_out,
12291233
dt_iop_roi_t *roi_in)
12301234
{
12311235
*roi_in = *roi_out;
@@ -1236,24 +1240,23 @@ void modify_roi_in(dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const d
12361240
roi_in->scale = 1.0f;
12371241
}
12381242

1239-
void distort_mask(
1240-
dt_iop_module_t *self,
1241-
dt_dev_pixelpipe_iop_t *piece,
1242-
const float *const in,
1243-
float *const out,
1244-
const dt_iop_roi_t *const roi_in,
1245-
const dt_iop_roi_t *const roi_out)
1243+
void distort_mask(dt_iop_module_t *self,
1244+
dt_dev_pixelpipe_iop_t *piece,
1245+
const float *const in,
1246+
float *const out,
1247+
const dt_iop_roi_t *const roi_in,
1248+
const dt_iop_roi_t *const roi_out)
12461249
{
12471250
dt_iop_copy_image_roi(out, in, 1, roi_in, roi_out);
12481251
}
12491252

1250-
void reload_defaults(dt_iop_module_t *module)
1253+
void reload_defaults(dt_iop_module_t *self)
12511254
{
12521255
// can't be switched on for non bayer RGB images:
1253-
if(!dt_image_is_bayerRGB(&module->dev->image_storage))
1256+
if(!dt_image_is_bayerRGB(&self->dev->image_storage))
12541257
{
1255-
module->hide_enable_button = TRUE;
1256-
module->default_enabled = FALSE;
1258+
self->hide_enable_button = TRUE;
1259+
self->default_enabled = FALSE;
12571260
}
12581261
}
12591262

src/iop/cacorrectrgb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,17 +692,17 @@ void gui_update(dt_iop_module_t *self)
692692
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->refine_manifolds), p->refine_manifolds);
693693
}
694694

695-
void reload_defaults(dt_iop_module_t *module)
695+
void reload_defaults(dt_iop_module_t *self)
696696
{
697-
dt_iop_cacorrectrgb_params_t *d = module->default_params;
697+
dt_iop_cacorrectrgb_params_t *d = self->default_params;
698698

699699
d->guide_channel = DT_CACORRECT_RGB_G;
700700
d->radius = 5.0f;
701701
d->strength = 0.5f;
702702
d->mode = DT_CACORRECT_MODE_STANDARD;
703703
d->refine_manifolds = FALSE;
704704

705-
dt_iop_cacorrectrgb_gui_data_t *g = module->gui_data;
705+
dt_iop_cacorrectrgb_gui_data_t *g = self->gui_data;
706706
if(g)
707707
{
708708
dt_bauhaus_combobox_set_default(g->guide_channel, d->guide_channel);

src/iop/channelmixer.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
This file is part of darktable,
3-
Copyright (C) 2010-2023 darktable developers.
3+
Copyright (C) 2010-2024 darktable developers.
44
55
darktable is free software: you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -589,17 +589,17 @@ void gui_update(dt_iop_module_t *self)
589589
}
590590
}
591591

592-
void init(dt_iop_module_t *module)
592+
void init(dt_iop_module_t *self)
593593
{
594-
dt_iop_default_init(module);
594+
dt_iop_default_init(self);
595595

596-
dt_iop_channelmixer_params_t *d = module->default_params;
596+
dt_iop_channelmixer_params_t *d = self->default_params;
597597

598598
d->algorithm_version = CHANNEL_MIXER_VERSION_2;
599599
d->red[CHANNEL_RED] = d->green[CHANNEL_GREEN] = d->blue[CHANNEL_BLUE] = 1.0;
600600
}
601601

602-
void gui_init(struct dt_iop_module_t *self)
602+
void gui_init(dt_iop_module_t *self)
603603
{
604604
dt_iop_channelmixer_gui_data_t *g = IOP_GUI_ALLOC(channelmixer);
605605
const dt_iop_channelmixer_params_t *const p = self->default_params;

src/iop/channelmixerrgb.c

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3756,9 +3756,8 @@ void gui_reset(dt_iop_module_t *self)
37563756

37573757
void gui_update(dt_iop_module_t *self)
37583758
{
3759-
dt_iop_module_t *module = (dt_iop_module_t *)self;
37603759
dt_iop_channelmixer_rgb_gui_data_t *g = self->gui_data;
3761-
dt_iop_channelmixer_rgb_params_t *p = module->params;
3760+
dt_iop_channelmixer_rgb_params_t *p = self->params;
37623761

37633762
dt_iop_color_picker_reset(self, TRUE);
37643763

@@ -3822,8 +3821,7 @@ void gui_update(dt_iop_module_t *self)
38223821
// always disable profiling mode by default
38233822
g->is_profiling_started = FALSE;
38243823

3825-
dt_iop_channelmixer_rgb_params_t *d =
3826-
(dt_iop_channelmixer_rgb_params_t *)module->default_params;
3824+
dt_iop_channelmixer_rgb_params_t *d = self->default_params;
38273825
g->last_daylight_temperature = d->temperature;
38283826
g->last_bb_temperature = d->temperature;
38293827

@@ -3839,39 +3837,39 @@ void gui_update(dt_iop_module_t *self)
38393837
gui_changed(self, NULL, NULL);
38403838
}
38413839

3842-
void init(dt_iop_module_t *module)
3840+
void init(dt_iop_module_t *self)
38433841
{
3844-
dt_iop_default_init(module);
3842+
dt_iop_default_init(self);
38453843

3846-
dt_iop_channelmixer_rgb_params_t *d = module->default_params;
3844+
dt_iop_channelmixer_rgb_params_t *d = self->default_params;
38473845
d->red[0] = d->green[1] = d->blue[2] = 1.0;
38483846
}
38493847

3850-
void reload_defaults(dt_iop_module_t *module)
3848+
void reload_defaults(dt_iop_module_t *self)
38513849
{
3852-
dt_iop_channelmixer_rgb_params_t *d = module->default_params;
3850+
dt_iop_channelmixer_rgb_params_t *d = self->default_params;
38533851

3854-
d->x = module->get_f("x")->Float.Default;
3855-
d->y = module->get_f("y")->Float.Default;
3856-
d->temperature = module->get_f("temperature")->Float.Default;
3857-
d->illuminant = module->get_f("illuminant")->Enum.Default;
3858-
d->adaptation = module->get_f("adaptation")->Enum.Default;
3852+
d->x = self->get_f("x")->Float.Default;
3853+
d->y = self->get_f("y")->Float.Default;
3854+
d->temperature = self->get_f("temperature")->Float.Default;
3855+
d->illuminant = self->get_f("illuminant")->Enum.Default;
3856+
d->adaptation = self->get_f("adaptation")->Enum.Default;
38593857

38603858
const gboolean is_workflow_none = dt_conf_is_equal("plugins/darkroom/workflow", "none");
38613859
const gboolean is_modern = dt_is_scene_referred() || is_workflow_none;
38623860

38633861
// note that if there is already an instance of this module with an
38643862
// adaptation set we default to RGB (none) in this instance.
38653863
// try to register the CAT here
3866-
_declare_cat_on_pipe(module, is_modern);
3867-
const dt_image_t *img = &module->dev->image_storage;
3864+
_declare_cat_on_pipe(self, is_modern);
3865+
const dt_image_t *img = &self->dev->image_storage;
38683866

38693867
// check if we could register
38703868
const gboolean CAT_already_applied =
3871-
(module->dev->chroma.adaptation != NULL) // CAT exists
3872-
&& (module->dev->chroma.adaptation != module); // and it is not us
3869+
(self->dev->chroma.adaptation != NULL) // CAT exists
3870+
&& (self->dev->chroma.adaptation != self); // and it is not us
38733871

3874-
module->default_enabled = FALSE;
3872+
self->default_enabled = FALSE;
38753873

38763874
if(CAT_already_applied || dt_image_is_monochrome(img))
38773875
{
@@ -3884,7 +3882,7 @@ void reload_defaults(dt_iop_module_t *module)
38843882
d->adaptation = DT_ADAPTATION_CAT16;
38853883

38863884
dt_aligned_pixel_t custom_wb;
3887-
if(!_get_white_balance_coeff(module, custom_wb))
3885+
if(!_get_white_balance_coeff(self, custom_wb))
38883886
{
38893887
if(find_temperature_from_raw_coeffs(img, custom_wb, &(d->x), &(d->y)))
38903888
d->illuminant = DT_ILLUMINANT_CAMERA;
@@ -3893,7 +3891,7 @@ void reload_defaults(dt_iop_module_t *module)
38933891
}
38943892
}
38953893

3896-
dt_iop_channelmixer_rgb_gui_data_t *g = module->gui_data;
3894+
dt_iop_channelmixer_rgb_gui_data_t *g = self->gui_data;
38973895
if(g)
38983896
{
38993897
const dt_aligned_pixel_t xyY = { d->x, d->y, 1.f };
@@ -3919,13 +3917,13 @@ void reload_defaults(dt_iop_module_t *module)
39193917
{
39203918
if(pos == -1)
39213919
dt_bauhaus_combobox_add_introspection(g->illuminant, NULL,
3922-
module->so->get_f("illuminant")->Enum.values,
3920+
self->so->get_f("illuminant")->Enum.values,
39233921
DT_ILLUMINANT_CAMERA, DT_ILLUMINANT_CAMERA);
39243922
}
39253923
else
39263924
dt_bauhaus_combobox_remove_at(g->illuminant, pos);
39273925

3928-
gui_changed(module, NULL, NULL);
3926+
gui_changed(self, NULL, NULL);
39293927
}
39303928
}
39313929

0 commit comments

Comments
 (0)