30 gboolean success =
TRUE;
31 gchar *clean_target_name = !
IS_NULL_PTR(target_module)
33 : g_strdup(_(
"export"));
35 ? g_strdup_printf(
"%s (%s)", clean_target_name, target_module->
multi_name)
36 : g_strdup(clean_target_name);
42 (!
IS_NULL_PTR(source_piece)) ?
"is defined" :
"is undefined",
43 (!
IS_NULL_PTR(current_piece)) ?
"is defined" :
"is undefined");
48 hint = g_strdup_printf(
49 _(
"- Check if the module providing the masks for the module %s has not been deleted.\n"),
55 hint = g_strdup_printf(_(
"- Check if the module %s (%s) providing the masks has not been moved above %s.\n"),
57 source_piece->module->multi_name, clean_target_name);
61 dt_control_log(_(
"The %s module is trying to reuse a mask from a module but it can't be found.\n"
63 target_name, hint ? hint :
"");
70 if(success && !source_piece->
enabled)
73 gchar *source_name = g_strdup_printf(
"%s (%s)", clean_source_name, source_piece->module->multi_name);
74 dt_control_log(_(
"The `%s` module is trying to reuse a mask from disabled module `%s`.\n"
75 "Disabled modules cannot provide their masks to other modules.\n"
76 "\n- Please enable `%s` or change the raster mask in `%s`."),
77 target_name, source_name, source_name, target_name);
80 target_name, source_name);
98 gchar *clean_target_name = !
IS_NULL_PTR(target_module)
100 : g_strdup(_(
"export"));
102 ? g_strdup_printf(
"%s (%s)", clean_target_name, target_module->
multi_name)
103 : g_strdup(clean_target_name);
107 dt_print(
DT_DEBUG_MASKS,
"[raster masks] The source module of the mask for %s was not found\n", target_name);
113 float *raster_mask = NULL;
117 GList *source_iter = NULL;
118 for(source_iter = g_list_last(pipe->
nodes); source_iter; source_iter = g_list_previous(source_iter))
121 if(candidate->module == target_module)
122 current_piece = candidate;
123 else if(candidate->module == raster_mask_source)
125 source_piece = candidate;
140 gchar *source_name = g_strdup_printf(
"%s (%s)", clean_source_name, source_piece->module->multi_name);
142 void *cache_data = NULL;
149 const size_t mask_size
169 memcpy(raster_mask, cache_data, mask_size);
176 "[raster masks] found cached mask id %i from %s for module %s"
177 " in pipe %s with hash %" PRIu64
"\n",
178 raster_mask_id, source_name, target_name,
type, raster_hash);
188 "[raster masks] missing source=%s instance=%d target=%s instance=%d"
189 " requested_id=%d cache_hash=%" PRIu64
" source_enabled=%d pipe=%s\n",
190 source_piece->module->op, source_piece->module->multi_priority,
193 raster_mask_id, raster_hash, source_piece->
enabled,
197 "[raster masks] mask id %i from %s for module %s could not be found"
198 " in the global cache for pipe %s.\n",
199 raster_mask_id, source_name, target_name,
type);
219 for(GList *iter = g_list_next(source_iter); iter; iter = g_list_next(iter))
226 if(module->module->distort_mask
227 && !(!strcmp(module->module->op,
"finalscale")
228 && module->roi_in.width == 0
229 && module->roi_in.height == 0))
232 (
size_t)module->roi_out.width * module->roi_out.height, 0);
245 module->module->distort_mask(module->module, pipe, module, raster_mask, transformed_mask,
246 &module->roi_in, &module->roi_out);
248 raster_mask = transformed_mask;
251 else if(!module->module->distort_mask
252 && (module->roi_in.width != module->roi_out.width
253 || module->roi_in.height != module->roi_out.height
254 || module->roi_in.x != module->roi_out.x
255 || module->roi_in.y != module->roi_out.y))
256 dt_print(
DT_DEBUG_MASKS,
"FIXME: module `%s' changed the roi from %d x %d @ %d / %d to %d x %d | %d / %d but doesn't have "
257 "distort_mask() implemented!\n", module->module->op, module->roi_in.width,
258 module->roi_in.height, module->roi_in.x, module->roi_in.y,
259 module->roi_out.width, module->roi_out.height, module->roi_out.x,
263 if(module->module == target_module)
267 raster_mask_id, source_name, clean_module_name,