![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "develop/masks.h"
Include dependency graph for masks_history.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| dt_masks_form_t * | dt_masks_form_ref (dt_masks_form_t *form) |
| void | dt_masks_form_unref (dt_masks_form_t *form) |
| dt_masks_form_t * | dt_masks_cow_touch (struct dt_develop_t *dev, dt_masks_form_t *form) |
| void | dt_masks_replace_current_forms (struct dt_develop_t *dev, GList *forms) |
| GList * | dt_masks_snapshot_current_forms (struct dt_develop_t *dev, gboolean reset_changed) |
Lifecycle and sharing of dt_masks_form_t objects between dev->forms and the per-history-item / undo-redo snapshots (hist->forms).
Forms are refcounted instead of deep-copied: dt_masks_snapshot_current_forms() and dt_masks_replace_current_forms() share pointers with dev->forms rather than cloning the whole flat list. A form is only cloned, on the spot, the moment it is actually about to be mutated while something else still references it (dt_masks_cow_touch).
Definition in file masks_history.h.
| dt_masks_form_t * dt_masks_cow_touch | ( | struct dt_develop_t * | dev, |
| dt_masks_form_t * | form | ||
| ) |
Ensure form is private to dev->forms before mutating it in place: if anything else still references it (refcount > 1, e.g. a history snapshot), clone it, splice the clone into dev->forms (and dev->form_gui->form_visible if it pointed at the old object) in its place, and release the old reference. Returns the form to mutate: either the original (fast path, refcount == 1) or the fresh clone. No-op (returns form unchanged) if form is not found in dev->forms (e.g. a transient, not-yet-appended in-creation shape).
Definition at line 38 of file masks_history.c.
References dt_atomic_get_int(), dt_masks_dup_masks_form(), dt_masks_form_unref(), dt_pthread_rwlock_unlock(), dt_pthread_rwlock_wrlock(), dt_develop_t::form_gui, dt_masks_form_gui_t::form_visible, dt_develop_t::forms, IS_NULL_PTR, dt_develop_t::masks_mutex, and dt_masks_form_t::refcount.
Referenced by _blendop_masks_all_toggled(), _blendop_masks_group_move_by_index(), _blendop_masks_group_operation_callback(), _masks_move_up_down_callback(), _masks_remove_or_delete_finish(), _masks_remove_shape(), _menu_add_exist(), _tree_add_exist(), _tree_duplicate_shape(), _tree_movedown(), _tree_moveup(), dt_masks_events_button_pressed(), dt_masks_events_button_released(), dt_masks_events_key_pressed(), dt_masks_events_mouse_moved(), dt_masks_events_mouse_scrolled(), dt_masks_form_change_opacity(), dt_masks_form_delete(), dt_masks_group_ungroup(), dt_masks_gui_form_save_creation(), dt_masks_iop_use_same_as(), and dt_masks_remove_node().
| dt_masks_form_t * dt_masks_form_ref | ( | dt_masks_form_t * | form | ) |
take a reference on a form (increments its refcount); returns the same pointer
Definition at line 24 of file masks_history.c.
References dt_atomic_add_int(), IS_NULL_PTR, and dt_masks_form_t::refcount.
Referenced by _dt_dev_history_item_duplicate_one(), dt_history_duplicate(), dt_masks_append_form(), dt_masks_replace_current_forms(), and dt_masks_snapshot_current_forms().
| void dt_masks_form_unref | ( | dt_masks_form_t * | form | ) |
release a reference on a form; frees it once the last reference is dropped. Signature matches GDestroyNotify for use with g_list_free_full().
Definition at line 31 of file masks_history.c.
References dt_atomic_sub_int(), dt_masks_free_form(), IS_NULL_PTR, and dt_masks_form_t::refcount.
Referenced by dt_dev_cleanup(), dt_dev_free_history_item(), dt_dev_history_item_update_from_params(), dt_dev_pixelpipe_cleanup(), dt_dev_pixelpipe_process(), dt_masks_cow_touch(), dt_masks_remove_form(), and dt_masks_replace_current_forms().
| void dt_masks_replace_current_forms | ( | struct dt_develop_t * | dev, |
| GList * | forms | ||
| ) |
replace dev->forms with forms: shares references with forms, does not deep-copy. forms is typically a hist->forms snapshot.
Definition at line 67 of file masks_history.c.
References dt_masks_form_invalidate_gravity_center(), dt_masks_form_ref(), dt_masks_form_unref(), dt_masks_get_from_id_ext(), dt_pthread_rwlock_unlock(), dt_pthread_rwlock_wrlock(), dt_develop_t::form_gui, dt_masks_form_gui_t::form_visible, dt_masks_form_t::formid, dt_develop_t::forms, IS_NULL_PTR, and dt_develop_t::masks_mutex.
Referenced by dt_dev_pop_history_items_ext(), dt_masks_cleanup_unused(), and dt_masks_read_masks_history().
| GList * dt_masks_snapshot_current_forms | ( | struct dt_develop_t * | dev, |
| gboolean | reset_changed | ||
| ) |
snapshot current dev->forms: shares references, does not deep-copy. Optionally reset dev->forms_changed.
Definition at line 101 of file masks_history.c.
References dt_masks_form_ref(), dt_pthread_rwlock_rdlock(), dt_pthread_rwlock_unlock(), FALSE, dt_develop_t::forms, dt_develop_t::forms_changed, and dt_develop_t::masks_mutex.
Referenced by dt_dev_add_history_item_ext(), dt_dev_history_item_from_source_history_item(), and dt_dev_pixelpipe_process().