Skip to content

Commit

Permalink
Remaining use of dt_iop_has_focus()
Browse files Browse the repository at this point in the history
Make use of dt_iop_has_focus() where appropriate.
  • Loading branch information
jenshannoschwalm committed Dec 1, 2024
1 parent 82aea77 commit b6d2fe8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 35 deletions.
18 changes: 4 additions & 14 deletions src/develop/blend.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,7 @@ void dt_develop_blend_process(dt_iop_module_t *self,
const dt_iop_roi_t *const roi_in,
const dt_iop_roi_t *const roi_out)
{
if(piece->pipe->bypass_blendif
&& self->dev->gui_attached
&& (self == self->dev->gui_module))
if(piece->pipe->bypass_blendif && dt_iop_has_focus(self))
return;

const dt_develop_blend_params_t *const d = piece->blendop_data;
Expand Down Expand Up @@ -545,10 +543,7 @@ void dt_develop_blend_process(dt_iop_module_t *self,
return;
}

const gboolean valid_request =
self->dev->gui_attached
&& (self == self->dev->gui_module)
&& (piece->pipe == self->dev->full.pipe);
const gboolean valid_request = dt_iop_has_focus(self) && (piece->pipe == self->dev->full.pipe);

// does user want us to display a specific channel?
const dt_dev_pixelpipe_display_mask_t request_mask_display =
Expand Down Expand Up @@ -934,9 +929,7 @@ gboolean dt_develop_blend_process_cl(dt_iop_module_t *self,
const dt_iop_roi_t *roi_in,
const dt_iop_roi_t *roi_out)
{
if(piece->pipe->bypass_blendif
&& self->dev->gui_attached
&& (self == self->dev->gui_module))
if(piece->pipe->bypass_blendif && dt_iop_has_focus(self))
return TRUE;

dt_develop_blend_params_t *const d = piece->blendop_data;
Expand Down Expand Up @@ -971,10 +964,7 @@ gboolean dt_develop_blend_process_cl(dt_iop_module_t *self,
// only non-zero if mask_display was set by an _earlier_ module
const dt_dev_pixelpipe_display_mask_t mask_display = piece->pipe->mask_display;

const gboolean valid_request =
self->dev->gui_attached
&& (self == self->dev->gui_module)
&& (piece->pipe == self->dev->full.pipe);
const gboolean valid_request = dt_iop_has_focus(self) && (piece->pipe == self->dev->full.pipe);

// does user want us to display a specific channel?
const dt_dev_pixelpipe_display_mask_t request_mask_display =
Expand Down
7 changes: 4 additions & 3 deletions src/iop/colorzones.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,9 @@ void process(dt_iop_module_t *self,
// display selection if requested
if((piece->pipe->type & DT_DEV_PIXELPIPE_FULL)
&& g
&& g->display_mask && self->dev->gui_attached
&& (self == self->dev->gui_module) && (piece->pipe == self->dev->full.pipe))
&& g->display_mask
&& dt_iop_has_focus(self)
&& (piece->pipe == self->dev->full.pipe))
process_display(self, piece, ivoid, ovoid, roi_in, roi_out);
else if(d->mode == DT_IOP_COLORZONES_MODE_SMOOTH)
process_v3(self, piece, ivoid, ovoid, roi_in, roi_out);
Expand All @@ -604,7 +605,7 @@ int process_cl(dt_iop_module_t *self,
dt_iop_colorzones_data_t *d = piece->data;
dt_iop_colorzones_global_data_t *gd = self->global_data;
cl_mem dev_L, dev_a, dev_b = NULL;
cl_int err = DT_OPENCL_DEFAULT_ERROR;
cl_int err = CL_MEM_OBJECT_ALLOCATION_FAILURE;

const int devid = piece->pipe->devid;
const int width = roi_in->width;
Expand Down
2 changes: 0 additions & 2 deletions src/iop/demosaicing/rcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,6 @@ static cl_int process_rcd_cl(dt_iop_module_t *self,
const int width = roi_in->width;
const int height = roi_in->height;

err = CL_MEM_OBJECT_ALLOCATION_FAILURE;

dev_tmp = dt_opencl_alloc_device(devid, roi_in->width, roi_in->height, sizeof(float) * 4);
if(dev_tmp == NULL) goto error;

Expand Down
25 changes: 9 additions & 16 deletions src/iop/retouch.c
Original file line number Diff line number Diff line change
Expand Up @@ -3870,9 +3870,7 @@ void process(dt_iop_module_t *self,
retouch_user_data_t usr_data = { 0 };
dwt_params_t *dwt_p = NULL;

const int gui_active = (self->dev) ? (self == self->dev->gui_module) : 0;
const gboolean display_wavelet_scale =
(g && gui_active) ? g->display_wavelet_scale : FALSE;
const gboolean display_wavelet_scale = g && dt_iop_has_focus(self) ? g->display_wavelet_scale : FALSE;

// we will do all the clone, heal, etc on the input image,
// this way the source for one algorithm can be the destination from a previous one
Expand All @@ -3891,8 +3889,7 @@ void process(dt_iop_module_t *self,
usr_data.mask_display = FALSE;
usr_data.suppress_mask = (g
&& g->suppress_mask
&& self->dev->gui_attached
&& (self == self->dev->gui_module)
&& dt_iop_has_focus(self)
&& (piece->pipe == self->dev->full.pipe));
usr_data.display_scale = p->curr_scale;

Expand All @@ -3908,8 +3905,8 @@ void process(dt_iop_module_t *self,

// check if this module should expose mask.
if((piece->pipe->type & DT_DEV_PIXELPIPE_FULL) && g
&& (g->mask_display || display_wavelet_scale) && self->dev->gui_attached
&& (self == self->dev->gui_module) && (piece->pipe == self->dev->full.pipe))
&& (g->mask_display || display_wavelet_scale)
&& dt_iop_has_focus(self) && (piece->pipe == self->dev->full.pipe))
{
for(size_t j = 0; j < (size_t)roi_rt->width * roi_rt->height * 4; j += 4)
in_retouch[j + 3] = 0.f;
Expand All @@ -3923,7 +3920,7 @@ void process(dt_iop_module_t *self,
if(piece->pipe->type & DT_DEV_PIXELPIPE_FULL)
{
// check if the image support this number of scales
if(gui_active)
if(dt_iop_has_focus(self))
{
const int max_scales = dwt_get_max_scale(dwt_p);
if(dwt_p->scales > max_scales)
Expand Down Expand Up @@ -4819,9 +4816,7 @@ int process_cl(dt_iop_module_t *self,
retouch_user_data_t usr_data = { 0 };
dwt_params_cl_t *dwt_p = NULL;

const int gui_active = (self->dev) ? (self == self->dev->gui_module) : 0;
const gboolean display_wavelet_scale =
(g && gui_active) ? g->display_wavelet_scale : FALSE;
const gboolean display_wavelet_scale = g && dt_iop_has_focus(self) ? g->display_wavelet_scale : FALSE;

// we will do all the clone, heal, etc on the input image, this way
// the source for one algorithm can be the destination from a
Expand Down Expand Up @@ -4851,8 +4846,7 @@ int process_cl(dt_iop_module_t *self,
usr_data.mask_display = FALSE;
usr_data.suppress_mask = (g
&& g->suppress_mask
&& self->dev->gui_attached
&& (self == self->dev->gui_module)
&& dt_iop_has_focus(self)
&& (piece->pipe == self->dev->full.pipe));
usr_data.display_scale = p->curr_scale;

Expand All @@ -4873,8 +4867,7 @@ int process_cl(dt_iop_module_t *self,
// check if this module should expose mask.
if((piece->pipe->type & DT_DEV_PIXELPIPE_FULL)
&& g && g->mask_display
&& self->dev->gui_attached
&& (self == self->dev->gui_module)
&& dt_iop_has_focus(self)
&& (piece->pipe == self->dev->full.pipe))
{
const int kernel = gd->kernel_retouch_clear_alpha;
Expand All @@ -4893,7 +4886,7 @@ int process_cl(dt_iop_module_t *self,
if(piece->pipe->type & DT_DEV_PIXELPIPE_FULL)
{
// check if the image support this number of scales
if(gui_active)
if(dt_iop_has_focus(self))
{
const int max_scales = dwt_get_max_scale_cl(dwt_p);
if(dwt_p->scales > max_scales)
Expand Down

0 comments on commit b6d2fe8

Please sign in to comment.