Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
develop.c File Reference
#include "common/darktable.h"
#include <assert.h>
#include <stddef.h>
#include <glib/gprintf.h>
#include <inttypes.h>
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include "common/atomic.h"
#include "common/datetime.h"
#include "common/debug.h"
#include "common/history.h"
#include "common/image_cache.h"
#include "common/imageio.h"
#include "common/mipmap_cache.h"
#include "common/opencl.h"
#include "common/tags.h"
#include "control/conf.h"
#include "control/control.h"
#include "control/signal.h"
#include "control/jobs.h"
#include "develop/blend.h"
#include "develop/develop.h"
#include "develop/imageop.h"
#include "develop/lightroom.h"
#include "develop/masks.h"
#include "develop/pixelpipe_cache.h"
#include "gui/gtk.h"
#include "gui/gui_throttle.h"
#include "gui/presets.h"
#include "libs/colorpicker.h"
+ Include dependency graph for develop.c:

Go to the source code of this file.

Data Structures

struct  dt_dev_multishow_state_t
 

Macros

#define DT_IOP_ORDER_INFO   (darktable.unmuted & DT_DEBUG_IOPORDER)
 

Typedefs

typedef struct dt_dev_multishow_state_t dt_dev_multishow_state_t
 

Functions

GList * dt_dev_load_modules (dt_develop_t *dev)
 
void dt_dev_init (dt_develop_t *dev, int32_t gui_attached)
 
void dt_dev_cleanup (dt_develop_t *dev)
 
static gboolean _update_darkroom_roi (dt_develop_t *dev, dt_dev_pixelpipe_t *pipe, int *x, int *y, int *wd, int *ht, float *scale)
 
static gboolean _darkroom_pipeline_inputs_ready (const dt_develop_t *dev)
 
int dt_dev_get_thumbnail_size (dt_develop_t *dev)
 
gboolean dt_dev_pixelpipe_has_preview_output (const dt_develop_t *dev, const dt_dev_pixelpipe_t *pipe, const dt_iop_roi_t *roi)
 
gboolean dt_dev_pipelines_share_preview_output (dt_develop_t *dev)
 Tell whether the darkroom main and preview pipes currently target the same GUI output.
 
static void dt_dev_resync_mipmap_cache (dt_develop_t *dev, dt_dev_pixelpipe_t *pipe, dt_iop_roi_t roi)
 
gboolean _resync_pipe_with_history (dt_develop_t *dev, dt_dev_pixelpipe_t *pipe, dt_iop_roi_t *roi, gboolean *needs_update)
 
void dt_dev_darkroom_pipeline (dt_develop_t *dev)
 Run darkroom preview and main pipelines from one background loop.
 
static int32_t dt_dev_process_job_run (dt_job_t *job)
 
dt_job_tdt_dev_process_job_create (dt_develop_t *dev)
 
void dt_dev_start_all_pipelines (dt_develop_t *dev)
 
static gboolean _dt_dev_mipmap_prefetch_full (dt_develop_t *dev, const int32_t imgid)
 
static gboolean _dt_dev_refresh_image_storage (dt_develop_t *dev, const int32_t imgid)
 
dt_dev_image_storage_t dt_dev_ensure_image_storage (dt_develop_t *dev, const int32_t imgid)
 
static dt_dev_image_storage_t _dt_dev_load_raw (dt_develop_t *dev, const int32_t imgid)
 
float dt_dev_get_zoom_scale (const dt_develop_t *dev, const gboolean preview)
 
dt_dev_image_storage_t dt_dev_load_image (dt_develop_t *dev, const int32_t imgid)
 
void dt_dev_configure_real (dt_develop_t *dev, int wd, int ht)
 
void dt_dev_check_zoom_pos_bounds (dt_develop_t *dev, float *dev_x, float *dev_y, float *box_w, float *box_h)
 Ensure that the current ROI position is within allowed bounds .
 
void dt_dev_get_processed_size (const dt_develop_t *dev, int *procw, int *proch)
 
void dt_dev_coordinates_widget_delta_to_image_delta (dt_develop_t *dev, float *points, size_t num_points)
 Convert a widget-space distance to processed-image pixels.
 
void dt_dev_coordinates_widget_to_image_norm (dt_develop_t *dev, float *points, size_t num_points)
 Coordinate conversion helpers between widget, normalized image, and absolute image spaces.
 
void dt_dev_coordinates_image_norm_to_widget (dt_develop_t *dev, float *points, size_t num_points)
 
void dt_dev_coordinates_image_norm_to_image_abs (dt_develop_t *dev, float *points, size_t num_points)
 
void dt_dev_coordinates_image_abs_to_image_norm (dt_develop_t *dev, float *points, size_t num_points)
 
void dt_dev_coordinates_raw_abs_to_raw_norm (dt_develop_t *dev, float *points, size_t num_points)
 
void dt_dev_coordinates_raw_norm_to_raw_abs (dt_develop_t *dev, float *points, size_t num_points)
 
void dt_dev_coordinates_image_norm_to_raw_norm (dt_develop_t *dev, float *points, size_t num_points)
 
void dt_dev_coordinates_raw_norm_to_image_norm (dt_develop_t *dev, float *points, size_t num_points)
 
void dt_dev_coordinates_image_abs_to_raw_norm (dt_develop_t *dev, float *points, size_t num_points)
 
void dt_dev_coordinates_image_norm_to_preview_abs (dt_develop_t *dev, float *points, size_t num_points)
 
void dt_dev_coordinates_preview_abs_to_image_norm (dt_develop_t *dev, float *points, size_t num_points)
 
int dt_dev_is_current_image (dt_develop_t *dev, int32_t imgid)
 
void dt_dev_modulegroups_switch_tab (dt_develop_t *dev, dt_iop_module_t *module)
 
void dt_dev_masks_list_change (dt_develop_t *dev)
 
void dt_dev_masks_list_update (dt_develop_t *dev)
 
void dt_dev_masks_list_remove (dt_develop_t *dev, int formid, int parentid)
 
void dt_dev_masks_selection_change (dt_develop_t *dev, struct dt_iop_module_t *module, const int selectid, const int throw_event)
 
void dt_dev_snapshot_request (dt_develop_t *dev, const char *filename)
 
dt_iop_module_tdt_dev_module_duplicate (dt_develop_t *dev, dt_iop_module_t *base)
 
void dt_dev_module_remove (dt_develop_t *dev, dt_iop_module_t *module)
 
void _dev_module_update_multishow (dt_develop_t *dev, struct dt_iop_module_t *module, const dt_dev_multishow_state_t *state)
 
void dt_dev_modules_update_multishow (dt_develop_t *dev)
 
gchar * dt_history_item_get_label (const struct dt_iop_module_t *module)
 
gchar * dt_dev_get_multi_name (const struct dt_iop_module_t *module)
 
gchar * dt_dev_get_masks_group_name (const struct dt_iop_module_t *module)
 
gchar * dt_history_item_get_name (const struct dt_iop_module_t *module)
 
gchar * dt_history_item_get_name_html (const struct dt_iop_module_t *module)
 
static int dt_dev_distort_backtransform_locked (const dt_dev_pixelpipe_t *pipe, const double iop_order, const int transf_direction, float *points, size_t points_count)
 
int dt_dev_coordinates_raw_abs_to_image_abs (dt_develop_t *dev, float *points, size_t points_count)
 
int dt_dev_coordinates_image_abs_to_raw_abs (dt_develop_t *dev, float *points, size_t points_count)
 
int dt_dev_distort_transform_locked (const dt_dev_pixelpipe_t *pipe, const double iop_order, const int transf_direction, float *points, size_t points_count)
 
int dt_dev_distort_transform_plus (const dt_dev_pixelpipe_t *pipe, const double iop_order, const int transf_direction, float *points, size_t points_count)
 
int dt_dev_distort_backtransform_plus (const dt_dev_pixelpipe_t *pipe, const double iop_order, const int transf_direction, float *points, size_t points_count)
 
dt_dev_pixelpipe_iop_tdt_dev_distort_get_iop_pipe (struct dt_dev_pixelpipe_t *pipe, struct dt_iop_module_t *module)
 
void dt_dev_signal_modules_moved (dt_develop_t *dev)
 
void dt_dev_undo_start_record (dt_develop_t *dev)
 
void dt_dev_undo_end_record (dt_develop_t *dev)
 
gboolean dt_masks_get_lock_mode (dt_develop_t *dev)
 
void dt_masks_set_lock_mode (dt_develop_t *dev, gboolean mode)
 
int32_t dt_dev_get_history_end_ext (dt_develop_t *dev)
 Get the current history end index (GUI perspective).
 
void dt_dev_set_history_end_ext (dt_develop_t *dev, const uint32_t index)
 Set the history end index (GUI perspective).
 
void dt_dev_append_changed_tag (const int32_t imgid)
 
void dt_dev_masks_update_hash (dt_develop_t *dev)
 
float dt_dev_get_natural_scale (dt_develop_t *dev)
 
float dt_dev_get_fit_scale (dt_develop_t *dev)
 Get the scale factor that maps preview-buffer pixels to GUI coordinates.
 
float dt_dev_get_overlay_scale (dt_develop_t *dev)
 Get the overlay scale factor in GUI logical coordinates.
 
float dt_dev_get_widget_zoom_scale (const dt_develop_t *dev, const float scaling)
 Convert a darkroom scaling factor to GUI logical zoom.
 
void dt_dev_get_widget_center (const dt_develop_t *dev, float *point)
 Get the center of the darkroom widget in logical coordinates.
 
void dt_dev_get_image_box_in_widget (const dt_develop_t *dev, const int32_t width, const int32_t height, float *box)
 Get the displayed image rectangle in darkroom widget coordinates.
 
float dt_dev_get_zoom_level (const dt_develop_t *dev)
 
void dt_dev_reset_roi (dt_develop_t *dev)
 
void dt_dev_convert_roi (const dt_develop_t *dev, const dt_iop_roi_t *roi_in, dt_iop_roi_t *roi_out, const dt_dev_roi_space_t from, const dt_dev_roi_space_t to)
 Convert a full ROI object between pipeline raster coordinates and GUI logical coordinates.
 
gboolean dt_dev_clip_roi (dt_develop_t *dev, cairo_t *cr, int32_t width, int32_t height)
 Clip the view to the ROI. WARNING: this must be done before any translation.
 
static gboolean _dev_translate_roi (dt_develop_t *dev, cairo_t *cr, int32_t width, int32_t height)
 
gboolean dt_dev_rescale_roi (dt_develop_t *dev, cairo_t *cr, int32_t width, int32_t height)
 Scale the ROI to fit within given width/height, centered.
 
gboolean dt_dev_rescale_roi_to_input (dt_develop_t *dev, cairo_t *cr, int32_t width, int32_t height)
 Scale the ROI to fit the input size within given width/height, centered.
 
gboolean dt_dev_check_zoom_scale_bounds (dt_develop_t *dev)
 Ensure that the current zoom level is within allowed bounds (for scrolling).
 
void dt_dev_update_mouse_effect_radius (dt_develop_t *dev)
 Convert absolute output-image coordinates to input image space by calling dt_dev_coordinates_image_abs_to_raw_abs() directly, then normalize with dt_dev_coordinates_raw_abs_to_raw_norm() when normalized raw coordinates are required.
 
void dt_dev_set_backbuf (dt_backbuf_t *backbuf, const int width, const int height, const size_t bpp, const int64_t hash, const int64_t history_hash)
 

Macro Definition Documentation

◆ DT_IOP_ORDER_INFO

#define DT_IOP_ORDER_INFO   (darktable.unmuted & DT_DEBUG_IOPORDER)

Definition at line 96 of file develop.c.

Typedef Documentation

◆ dt_dev_multishow_state_t

Function Documentation

◆ _darkroom_pipeline_inputs_ready()

◆ _dev_module_update_multishow()

◆ _dev_translate_roi()

static gboolean _dev_translate_roi ( dt_develop_t dev,
cairo_t *  cr,
int32_t  width,
int32_t  height 
)
static

◆ _dt_dev_load_raw()

static dt_dev_image_storage_t _dt_dev_load_raw ( dt_develop_t dev,
const int32_t  imgid 
)
inlinestatic

Definition at line 862 of file develop.c.

References dt_dev_ensure_image_storage(), dt_get_times(), and dt_show_times_f().

Referenced by dt_dev_load_image().

◆ _dt_dev_mipmap_prefetch_full()

◆ _dt_dev_refresh_image_storage()

static gboolean _dt_dev_refresh_image_storage ( dt_develop_t dev,
const int32_t  imgid 
)
static

◆ _resync_pipe_with_history()

◆ _update_darkroom_roi()

◆ dt_dev_append_changed_tag()

void dt_dev_append_changed_tag ( const int32_t  imgid)

◆ dt_dev_check_zoom_pos_bounds()

void dt_dev_check_zoom_pos_bounds ( dt_develop_t dev,
float *  dev_x,
float *  dev_y,
float *  box_w,
float *  box_h 
)

Ensure that the current ROI position is within allowed bounds .

Parameters
devthe develop instance
dev_xthe normalized x position of ROI
dev_ythe normalized y position of ROI
box_wthe width of navigation's box
box_hthe height of navigation's box

Definition at line 944 of file develop.c.

References CLAMPF, dt_dev_get_processed_size(), dt_dev_get_zoom_level(), dt_develop_t::height, IS_NULL_PTR, dt_develop_t::roi, dt_develop_t::scaling, and dt_develop_t::width.

Referenced by _change_scaling(), _darkroom_edge_pan_apply(), _key_scroll(), _lib_navigation_draw_callback(), _lib_navigation_set_position(), _zoom_preset_change(), dt_masks_center_view_on_form(), and mouse_moved().

◆ dt_dev_check_zoom_scale_bounds()

gboolean dt_dev_check_zoom_scale_bounds ( dt_develop_t dev)

Ensure that the current zoom level is within allowed bounds (for scrolling).

Parameters
devthe develop instance
Returns
gboolean TRUE if the zoom level was adjusted, FALSE otherwise

Definition at line 1844 of file develop.c.

References FALSE, dt_develop_t::natural_scale, dt_develop_t::roi, dt_develop_t::scaling, and TRUE.

Referenced by _change_scaling().

◆ dt_dev_cleanup()

void dt_dev_cleanup ( dt_develop_t dev)

Definition at line 188 of file develop.c.

References dt_develop_t::allforms, dt_develop_t::alliop, dt_develop_t::allprofile_info, dt_develop_t::blend_params, dt_develop_t::chroma_adaptation, dt_develop_t::color_picker, dt_develop_t::colorscheme, dt_conf_set_float(), dt_conf_set_int(), dt_dev_free_history_item(), dt_dev_pixelpipe_cleanup(), dt_free, dt_free_align, dt_free_gpointer(), dt_gui_throttle_cancel(), dt_iop_cleanup_module(), dt_ioppr_cleanup_profile_info(), dt_masks_free_form(), dt_pthread_mutex_destroy(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_pthread_rwlock_destroy, dt_pthread_rwlock_unlock, dt_pthread_rwlock_wrlock, dt_develop_t::forms, dt_develop_t::histogram_pre_levels, dt_develop_t::histogram_pre_tonecurve, dt_develop_t::history, dt_develop_t::history_mutex, dt_develop_t::iop, dt_develop_t::iop_order_list, IS_NULL_PTR, dt_develop_t::lower, dt_develop_t::masks_mutex, dt_develop_t::mode, dt_develop_t::overexposed, dt_develop_t::params, dt_develop_t::pipe, dt_develop_t::preview_pipe, dt_develop_t::primary_sample, dt_develop_t::proxy, dt_develop_t::rawoverexposed, dt_develop_t::threshold, dt_develop_t::transient_params, dt_develop_t::transient_params_mutex, dt_develop_t::undo_history_before_end, dt_develop_t::undo_history_before_iop_order_list, dt_develop_t::undo_history_before_snapshot, dt_develop_t::undo_history_depth, dt_develop_t::upper, dt_develop_t::virtual_pipe, void(), and dt_develop_t::wb_coeffs.

Referenced by _history_compress_apply(), _history_copy_and_paste_on_image_merge(), _lib_snapshot_capture_state(), _lib_snapshot_clear_state(), cleanup(), dt_dev_merge_history_into_image(), dt_focus_draw_clusters(), dt_imageio_export_with_flags(), and dt_styles_apply_to_image_merge().

◆ dt_dev_clip_roi()

gboolean dt_dev_clip_roi ( dt_develop_t dev,
cairo_t *  cr,
int32_t  width,
int32_t  height 
)

Clip the view to the ROI. WARNING: this must be done before any translation.

Parameters
devthe develop instance
crthe cairo context to clip on
widththe view width
heightthe view height
Returns
gboolean TRUE if the image dimension are 0x0

Definition at line 1781 of file develop.c.

References dt_develop_t::border_size, dt_dev_get_overlay_scale(), FALSE, height, dt_develop_t::preview_height, dt_develop_t::preview_width, dt_develop_t::roi, TRUE, and width.

Referenced by expose(), and gui_post_expose().

◆ dt_dev_configure_real()

◆ dt_dev_convert_roi()

void dt_dev_convert_roi ( const dt_develop_t dev,
const dt_iop_roi_t roi_in,
dt_iop_roi_t roi_out,
const dt_dev_roi_space_t  from,
const dt_dev_roi_space_t  to 
)

Convert a full ROI object between pipeline raster coordinates and GUI logical coordinates.

The pipeline stores ROI geometry in real buffer pixels while Gtk events and drawing use logical coordinates. x/y/width/height cross that boundary through the ppd factor, while roi->scale remains the same because it expresses image-space sampling, not GUI density.

Parameters
devthe develop instance carrying the ppd factor
roi_inthe source ROI
roi_outthe converted ROI
fromthe source coordinate space
tothe destination coordinate space

Definition at line 1759 of file develop.c.

References darktable, DT_DEV_ROI_GUI_LOGICAL, DT_DEV_ROI_PIPELINE, factor, darktable_t::gui, dt_iop_roi_t::height, IS_NULL_PTR, dt_gui_gtk_t::ppd, dt_iop_roi_t::scale, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.

Referenced by dt_dev_configure_real().

◆ dt_dev_coordinates_image_abs_to_image_norm()

◆ dt_dev_coordinates_image_abs_to_raw_abs()

int dt_dev_coordinates_image_abs_to_raw_abs ( dt_develop_t dev,
float *  points,
size_t  points_count 
)

◆ dt_dev_coordinates_image_abs_to_raw_norm()

◆ dt_dev_coordinates_image_norm_to_image_abs()

◆ dt_dev_coordinates_image_norm_to_preview_abs()

◆ dt_dev_coordinates_image_norm_to_raw_norm()

◆ dt_dev_coordinates_image_norm_to_widget()

◆ dt_dev_coordinates_preview_abs_to_image_norm()

◆ dt_dev_coordinates_raw_abs_to_image_abs()

int dt_dev_coordinates_raw_abs_to_image_abs ( dt_develop_t dev,
float *  points,
size_t  points_count 
)

apply all transforms to the specified points (in virtual preview-pipe space)

Definition at line 1525 of file develop.c.

References dt_dev_distort_transform_plus(), DT_DEV_TRANSFORM_DIR_ALL, and dt_develop_t::virtual_pipe.

Referenced by _circle_get_points(), _ellipse_get_points(), _gradient_get_points(), dt_dev_coordinates_raw_norm_to_image_norm(), and dt_masks_center_view_on_form().

◆ dt_dev_coordinates_raw_abs_to_raw_norm()

◆ dt_dev_coordinates_raw_norm_to_image_norm()

◆ dt_dev_coordinates_raw_norm_to_raw_abs()

◆ dt_dev_coordinates_widget_delta_to_image_delta()

void dt_dev_coordinates_widget_delta_to_image_delta ( dt_develop_t dev,
float *  points,
size_t  num_points 
)

Convert a widget-space distance to processed-image pixels.

Mouse drags and GUI handle sizes are expressed in darkroom logical pixels. Interactive modules compare them against image data, so this helper applies the current widget zoom once in the develop API instead of duplicating the same division in every callback.

Parameters
devthe develop instance
pointspointer to num_points delta pairs stored as {dx, dy}; data is modified in place.
num_pointsnumber of delta pairs referenced by points.

Definition at line 986 of file develop.c.

References darktable, dt_dev_get_zoom_level(), darktable_t::gui, i, IS_NULL_PTR, and dt_gui_gtk_t::ppd.

Referenced by _darkroom_edge_pan_apply(), button_pressed(), key_pressed(), and mouse_moved().

◆ dt_dev_coordinates_widget_to_image_norm()

void dt_dev_coordinates_widget_to_image_norm ( dt_develop_t dev,
float *  points,
size_t  num_points 
)

Coordinate conversion helpers between widget, normalized image, and absolute image spaces.

Widget space is assumed to be the darkroom center view and doesn't account for borders, zooming, panning, etc. RAW space is the full-resolution input fed to the pipeline. Image space is the output image resulting from applying a full history over the full-resolution input. Preview space is the downscaled output image preview as displayed in darkroom.

Parameters
devdevelop instance
pointspointer to num_points coordinate pairs stored as {x, y}; data is modified in place.
num_pointsnumber of coordinate pairs referenced by points.

Definition at line 1003 of file develop.c.

References darktable, dt_dev_get_zoom_level(), darktable_t::gui, i, IS_NULL_PTR, dt_develop_t::orig_height, dt_develop_t::orig_width, dt_gui_gtk_t::ppd, dt_develop_t::processed_height, dt_develop_t::processed_width, dt_develop_t::roi, dt_develop_t::x, and dt_develop_t::y.

Referenced by _dt_masks_events_set_current_pos(), button_pressed(), button_pressed(), button_released(), dt_drawlayer_widget_points_to_layer_coords(), get_point_scale(), gui_post_expose(), mouse_moved(), mouse_moved(), and scrolled().

◆ dt_dev_darkroom_pipeline()

void dt_dev_darkroom_pipeline ( dt_develop_t dev)

Run darkroom preview and main pipelines from one background loop.

Preview must be serviced before the main pipe so both darkroom pipelines can share freshly-published cachelines without cross-thread timeout heuristics. Pause state, dirty detection, history resync, ROI updates, and re-entry handling stay local to each pipe, but their execution order is now explicit and deterministic.

GUI sampling and picker notifications are intentionally delayed until both ordered pipe runs completed so GUI observers consume the preview-first, main-second cache state from the same loop.

A missing raster mask gets exactly one reconstruction pass. Keep the re-entry flag active for that pass so _bypass_cache() recomputes the provider instead of exact-hitting pixels without their side-band mask. If the retry still cannot provide it, release the flag and propagate the processing error without scheduling an infinite loop.

Snapshot the GUI request before processing because it may be cleared while this pipe is running although the resulting backbuffer still contains the requested mask preview.

Module cache requests deliberately stop before the end of the pipe. DT_SIGNAL_CACHELINE_READY notifies their caller when the requested cache line is written, but the final backbuffer remains stale. Advertising PIPE_FINISHED for such a pass would wake preview consumers and schedule another otherwise unnecessary processing pass.

Todo:
: cache raster masks too (was attempted before, and failed).

A module cache request consumes the pipe change that started this worker pass, but intentionally stops before publishing the final backbuffer. Queue the full continuation explicitly instead of relying on a PIPE_FINISHED listener to notice the missing backbuffer. A newer GUI cache request may have arrived while processing; preserve it and only install the backbuffer request when no newer target is pending.

Use the full-frame preview backbuffer to initialize the mipmap cache without extra computations. Thumbnails consume that cache, so never publish a transient mask display there. Check both the request snapshot and the runtime display mode because modules may produce their mask through either mechanism.

This resamples non-linear uint8 at the end of the pipeline and is therefore a low-quality resampling path.

Definition at line 557 of file develop.c.

References _darkroom_pipeline_inputs_ready(), _resync_pipe_with_history(), dt_dev_pixelpipe_t::busy_mutex, dt_develop_t::completed, darktable, dt_atomic_get_int(), dt_atomic_set_int(), dt_control_log_busy_enter(), dt_control_log_busy_leave(), dt_control_queue_redraw(), dt_control_queue_redraw_center(), dt_control_running(), dt_control_toast_busy_enter(), dt_control_toast_busy_leave(), DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_DEBUG_DEV, DT_DEBUG_PIPE, DT_DEV_PIPE_CACHE_REQUEST, DT_DEV_PIPE_REENTRY, DT_DEV_PIXELPIPE_CACHE_REQUEST_BACKBUF, DT_DEV_PIXELPIPE_CACHE_REQUEST_MODULE, DT_DEV_PIXELPIPE_CACHE_REQUEST_NONE, DT_DEV_PIXELPIPE_DISPLAY_NONE, DT_DEV_PIXELPIPE_FULL, dt_dev_pixelpipe_get_cache_request(), dt_dev_pixelpipe_get_realtime(), dt_dev_pixelpipe_has_preview_output(), dt_dev_pixelpipe_has_reentry(), dt_dev_pixelpipe_is_backbufer_valid(), dt_dev_pixelpipe_or_changed(), DT_DEV_PIXELPIPE_PREVIEW, dt_dev_pixelpipe_process(), dt_dev_pixelpipe_reset_reentry(), dt_dev_pixelpipe_set_cache_request(), dt_dev_pixelpipe_set_input(), dt_dev_resync_mipmap_cache(), dt_free, dt_get_times(), dt_gui_throttle_record_runtime(), dt_iop_nap(), DT_MIPMAP_FULL, dt_pixelpipe_get_pipe_name(), dt_print(), dt_pthread_mutex_lock(), dt_pthread_mutex_unlock(), dt_show_times(), DT_SIGNAL_DEVELOP_PREVIEW_PIPE_FINISHED, DT_SIGNAL_DEVELOP_UI_PIPE_FINISHED, DT_SIGNAL_HISTORY_RESYNC, dt_develop_t::exit, FALSE, dt_develop_t::gui_module, i, dt_image_t::id, dt_develop_t::image_storage, IS_NULL_PTR, dt_dev_pixelpipe_t::mask_display, dt_develop_t::pipe, dt_develop_t::preview_pipe, dt_dev_pixelpipe_t::processing, dt_develop_t::progress, dt_develop_t::raw_height, dt_develop_t::raw_width, dt_iop_module_t::request_mask_display, dt_develop_t::roi, dt_dev_pixelpipe_t::shutdown, darktable_t::signals, dt_develop_t::total, and dt_dev_pixelpipe_t::type.

Referenced by dt_dev_process_job_run().

◆ dt_dev_distort_backtransform_locked()

static int dt_dev_distort_backtransform_locked ( const dt_dev_pixelpipe_t pipe,
const double  iop_order,
const int  transf_direction,
float *  points,
size_t  points_count 
)
static

◆ dt_dev_distort_backtransform_plus()

◆ dt_dev_distort_get_iop_pipe()

◆ dt_dev_distort_transform_locked()

int dt_dev_distort_transform_locked ( const dt_dev_pixelpipe_t pipe,
const double  iop_order,
const int  transf_direction,
float *  points,
size_t  points_count 
)

◆ dt_dev_distort_transform_plus()

◆ dt_dev_ensure_image_storage()

◆ dt_dev_get_fit_scale()

float dt_dev_get_fit_scale ( dt_develop_t dev)

Get the scale factor that maps preview-buffer pixels to GUI coordinates.

The pipeline ROI is stored in raster pixels. GUI drawing still happens in Gtk logical coordinates, so this helper exposes the explicit raster-to-GUI conversion used by overlays.

Parameters
devthe develop instance
Returns
float : the fit scale factor

Definition at line 1706 of file develop.c.

References darktable, darktable_t::gui, IS_NULL_PTR, dt_gui_gtk_t::ppd, dt_develop_t::roi, and dt_develop_t::scaling.

Referenced by _darkroom_pickers_draw(), button_pressed(), dt_dev_get_overlay_scale(), and dt_dev_rescale_roi().

◆ dt_dev_get_history_end_ext()

◆ dt_dev_get_image_box_in_widget()

void dt_dev_get_image_box_in_widget ( const dt_develop_t dev,
int32_t  width,
int32_t  height,
float *  box 
)

Get the displayed image rectangle in darkroom widget coordinates.

Input callbacks often need to know whether the pointer is inside the image or in the margin area. This exposes the current displayed backbuffer footprint in logical coordinates, including the ppd conversion.

Parameters
devthe develop instance
widththe current darkroom widget width
heightthe current darkroom widget height
boxreturned image box stored as {x, y, width, height}

Definition at line 1730 of file develop.c.

References dt_develop_t::border_size, darktable, darktable_t::gui, height, IS_NULL_PTR, dt_gui_gtk_t::ppd, dt_develop_t::preview_height, dt_develop_t::preview_width, dt_develop_t::roi, dt_develop_t::scaling, and width.

Referenced by _build_preview_fallback_surface(), _darkroom_edge_pan_update_state(), gui_post_expose(), and mouse_in_imagearea().

◆ dt_dev_get_masks_group_name()

gchar * dt_dev_get_masks_group_name ( const struct dt_iop_module_t module)

Get the module multi name, or the module name if no multi name is provided

Definition at line 1479 of file develop.c.

References dt_dev_get_multi_name(), dt_free, and dt_history_item_get_name().

Referenced by _blendop_masks_group_name_commit(), _set_group_name_from_module(), and dt_iop_gui_init_masks().

◆ dt_dev_get_multi_name()

gchar * dt_dev_get_multi_name ( const struct dt_iop_module_t module)

generates item multi-instance name without mnemonics

Definition at line 1471 of file develop.c.

References dt_iop_module_t::multi_name.

Referenced by _ioporder_create_graph_node(), and dt_dev_get_masks_group_name().

◆ dt_dev_get_natural_scale()

◆ dt_dev_get_overlay_scale()

float dt_dev_get_overlay_scale ( dt_develop_t dev)

Get the overlay scale factor in GUI logical coordinates.

This is the GUI-space scale used to draw preview overlays from the raster backbuffer dimensions stored in the pipeline ROI.

Parameters
devthe develop instance
Returns
float :the overlay scale factor

Definition at line 1712 of file develop.c.

References dt_dev_get_fit_scale().

Referenced by _draw_near_point(), button_pressed(), dt_dev_clip_roi(), dt_drawlayer_compute_view_patch(), expose(), gui_post_expose(), gui_post_expose(), and mouse_moved().

◆ dt_dev_get_processed_size()

◆ dt_dev_get_thumbnail_size()

◆ dt_dev_get_widget_center()

void dt_dev_get_widget_center ( const dt_develop_t dev,
float *  point 
)

Get the center of the darkroom widget in logical coordinates.

Parameters
devthe develop instance
pointreturned widget center stored as {x, y}

Definition at line 1723 of file develop.c.

References IS_NULL_PTR, dt_develop_t::orig_height, dt_develop_t::orig_width, and dt_develop_t::roi.

Referenced by _change_scaling(), and key_pressed().

◆ dt_dev_get_widget_zoom_scale()

float dt_dev_get_widget_zoom_scale ( const dt_develop_t dev,
float  scaling 
)

Convert a darkroom scaling factor to GUI logical zoom.

Pipeline zoom is tracked in raster-space units. Gtk callbacks and overlay drawing operate in logical widget coordinates, so the ppd correction belongs here rather than at every interactive call site.

Parameters
devthe develop instance
scalingthe darkroom scaling factor to evaluate
Returns
float : the GUI logical zoom

Definition at line 1717 of file develop.c.

References darktable, darktable_t::gui, IS_NULL_PTR, dt_develop_t::natural_scale, dt_gui_gtk_t::ppd, dt_develop_t::roi, and scaling.

Referenced by _change_scaling().

◆ dt_dev_get_zoom_level()

◆ dt_dev_get_zoom_scale()

◆ dt_dev_init()

void dt_dev_init ( dt_develop_t dev,
int32_t  gui_attached 
)
Todo:
: these are uint32_t, setting to -1 is confusing

Definition at line 128 of file develop.c.

References dt_develop_t::color_picker, dt_develop_t::colorscheme, dt_develop_t::display_histogram, dt_develop_t::display_samples, dt_conf_get_bool(), dt_conf_get_float(), dt_conf_get_int(), dt_dev_load_modules(), dt_dev_pixelpipe_init(), dt_dev_pixelpipe_init_preview(), dt_dev_reset_roi(), dt_dev_set_backbuf(), dt_dev_set_history_hash(), dt_image_init(), DT_PIXELPIPE_CACHE_HASH_INVALID, dt_pthread_mutex_init(), dt_pthread_rwlock_init, dt_develop_t::gui_attached, dt_develop_t::height, dt_develop_t::histogram_pre_levels, dt_develop_t::histogram_pre_levels_max, dt_develop_t::histogram_pre_tonecurve, dt_develop_t::histogram_pre_tonecurve_max, dt_develop_t::history_mutex, dt_develop_t::image_storage, dt_develop_t::iop, dt_develop_t::live_samples_enabled, dt_develop_t::lower, dt_develop_t::masks_mutex, dt_develop_t::mode, dt_develop_t::output_histogram, dt_develop_t::overexposed, dt_develop_t::pipe, dt_develop_t::preview_pipe, dt_develop_t::primary_sample, dt_develop_t::proxy, dt_develop_t::raw_histogram, dt_develop_t::rawoverexposed, dt_develop_t::restrict_histogram, dt_develop_t::roi, dt_develop_t::threshold, dt_develop_t::transient_params_mutex, TRUE, dt_develop_t::upper, dt_develop_t::virtual_pipe, dt_develop_t::wb_coeffs, dt_develop_t::wb_is_D65, and dt_develop_t::width.

Referenced by _history_compress_apply(), _history_copy_and_paste_on_image_merge(), _lib_snapshot_capture_state(), _styles_init_source_dev(), dt_dev_merge_history_into_image(), dt_focus_draw_clusters(), dt_imageio_export_with_flags(), and init().

◆ dt_dev_is_current_image()

int dt_dev_is_current_image ( dt_develop_t dev,
int32_t  imgid 
)

checks if provided imgid is the image currently in develop

Definition at line 1176 of file develop.c.

References dt_image_t::id, and dt_develop_t::image_storage.

◆ dt_dev_load_image()

◆ dt_dev_load_modules()

GList * dt_dev_load_modules ( dt_develop_t dev)

◆ dt_dev_masks_list_change()

void dt_dev_masks_list_change ( dt_develop_t dev)

Definition at line 1187 of file develop.c.

References dt_develop_t::list_change, dt_develop_t::masks, and dt_develop_t::proxy.

Referenced by dt_dev_read_history_ext().

◆ dt_dev_masks_list_remove()

void dt_dev_masks_list_remove ( dt_develop_t dev,
int  formid,
int  parentid 
)

Definition at line 1197 of file develop.c.

References dt_develop_t::list_remove, dt_develop_t::masks, and dt_develop_t::proxy.

◆ dt_dev_masks_list_update()

void dt_dev_masks_list_update ( dt_develop_t dev)

◆ dt_dev_masks_selection_change()

◆ dt_dev_masks_update_hash()

void dt_dev_masks_update_hash ( dt_develop_t dev)

integrity hash of the forms/shapes stack

Definition at line 1681 of file develop.c.

References dt_masks_group_get_hash(), dt_develop_t::forms, dt_develop_t::forms_changed, and dt_develop_t::forms_hash.

Referenced by _delayed_history_commit(), and dt_dev_read_history_ext().

◆ dt_dev_module_duplicate()

◆ dt_dev_module_remove()

◆ dt_dev_modulegroups_switch_tab()

void dt_dev_modulegroups_switch_tab ( dt_develop_t dev,
struct dt_iop_module_t module 
)

request modulegroups to show the group of the given module

Definition at line 1181 of file develop.c.

References darktable, DT_DEBUG_CONTROL_SIGNAL_RAISE, DT_SIGNAL_DEVELOP_MODULEGROUPS_SET, IS_NULL_PTR, and darktable_t::signals.

Referenced by dt_iop_request_focus().

◆ dt_dev_modules_update_multishow()

void dt_dev_modules_update_multishow ( dt_develop_t dev)

◆ dt_dev_pipelines_share_preview_output()

gboolean dt_dev_pipelines_share_preview_output ( dt_develop_t dev)

Tell whether the darkroom main and preview pipes currently target the same GUI output.

When both pipes would render the same geometry, preview must run first so the main pipe can reuse its backbuffer instead of recomputing the same image concurrently.

Definition at line 457 of file develop.c.

References _update_darkroom_roi(), FALSE, dt_develop_t::gui_attached, IS_NULL_PTR, dt_develop_t::output_inited, dt_develop_t::pipe, dt_develop_t::preview_pipe, and dt_develop_t::roi.

Referenced by expose().

◆ dt_dev_pixelpipe_has_preview_output()

◆ dt_dev_process_job_create()

dt_job_t * dt_dev_process_job_create ( dt_develop_t dev)

◆ dt_dev_process_job_run()

static int32_t dt_dev_process_job_run ( dt_job_t job)
static

Definition at line 796 of file develop.c.

References dt_control_job_get_params(), and dt_dev_darkroom_pipeline().

Referenced by dt_dev_process_job_create().

◆ dt_dev_rescale_roi()

gboolean dt_dev_rescale_roi ( dt_develop_t dev,
cairo_t *  cr,
int32_t  width,
int32_t  height 
)

Scale the ROI to fit within given width/height, centered.

Parameters
devthe develop instance
crthe cairo context to draw on
widththe widget width
heightthe widget height
Returns
gboolean TRUE if the image dimension are 0x0

Definition at line 1824 of file develop.c.

References _dev_translate_roi(), dt_dev_get_fit_scale(), FALSE, height, TRUE, and width.

Referenced by _darkroom_pickers_draw(), expose(), and gui_post_expose().

◆ dt_dev_rescale_roi_to_input()

gboolean dt_dev_rescale_roi_to_input ( dt_develop_t dev,
cairo_t *  cr,
int32_t  width,
int32_t  height 
)

Scale the ROI to fit the input size within given width/height, centered.

Parameters
devthe develop instance
crthe cairo context to draw on
widththe widget width
heightthe widget height
Returns
gboolean TRUE if the image dimension are 0x0

Definition at line 1834 of file develop.c.

References _dev_translate_roi(), darktable, dt_dev_get_zoom_level(), FALSE, darktable_t::gui, height, dt_gui_gtk_t::ppd, TRUE, and width.

Referenced by dt_masks_events_post_expose(), and gui_post_expose().

◆ dt_dev_reset_roi()

void dt_dev_reset_roi ( dt_develop_t dev)

◆ dt_dev_resync_mipmap_cache()

◆ dt_dev_set_backbuf()

void dt_dev_set_backbuf ( dt_backbuf_t backbuf,
const int  width,
const int  height,
const size_t  bpp,
const int64_t  hash,
const int64_t  history_hash 
)

◆ dt_dev_set_history_end_ext()

void dt_dev_set_history_end_ext ( struct dt_develop_t dev,
const uint32_t  index 
)

Set the history end index (GUI perspective).

The index is 1-based with 0 representing the raw input image. The value is sanitized against the actual history length.

Parameters
devDevelop context.
indexNew history end index.

Definition at line 1665 of file develop.c.

References dt_dev_history_compute_hash(), dt_dev_set_history_hash(), dt_develop_t::history, and dt_develop_t::history_end.

Referenced by _dt_dev_history_compress_internal(), _history_apply_history_end(), _hm_restore_dest_from_backup(), _lib_snapshot_capture_state(), _pop_undo(), _styles_rebuild_history_from_items(), dt_dev_add_history_item_ext(), dt_dev_module_remove(), dt_dev_read_history_ext(), and dt_history_merge().

◆ dt_dev_signal_modules_moved()

void dt_dev_signal_modules_moved ( dt_develop_t dev)

◆ dt_dev_snapshot_request()

void dt_dev_snapshot_request ( dt_develop_t dev,
const char *  filename 
)

◆ dt_dev_start_all_pipelines()

◆ dt_dev_undo_end_record()

◆ dt_dev_undo_start_record()

◆ dt_dev_update_mouse_effect_radius()

void dt_dev_update_mouse_effect_radius ( dt_develop_t dev)

Convert absolute output-image coordinates to input image space by calling dt_dev_coordinates_image_abs_to_raw_abs() directly, then normalize with dt_dev_coordinates_raw_abs_to_raw_norm() when normalized raw coordinates are required.

Definition at line 1869 of file develop.c.

References darktable, DT_DEBUG_MASKS, dt_dev_get_zoom_level(), DT_PIXEL_APPLY_DPI, dt_print(), dt_gui_gtk_t::effect_radius, dt_gui_gtk_t::effect_radius_clamped, darktable_t::gui, dt_gui_gtk_t::mouse, and dt_gui_gtk_t::ppd.

Referenced by dt_dev_get_thumbnail_size(), and dt_dev_pixelpipe_change_zoom_main().

◆ dt_history_item_get_label()

gchar * dt_history_item_get_label ( const struct dt_iop_module_t module)

generate item multi-instance name with mnemonics, for Gtk labels

Definition at line 1458 of file develop.c.

References dt_iop_module_t::multi_name.

Referenced by _iop_panel_label().

◆ dt_history_item_get_name()

◆ dt_history_item_get_name_html()

gchar * dt_history_item_get_name_html ( const struct dt_iop_module_t module)

Definition at line 1509 of file develop.c.

References delete_underscore(), dt_free, and dt_iop_module_t::multi_name.

◆ dt_masks_get_lock_mode()

◆ dt_masks_set_lock_mode()

void dt_masks_set_lock_mode ( dt_develop_t dev,
gboolean  mode 
)