![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "develop/masks/masks_history.h"#include "develop/masks.h"#include "develop/masks_gui.h"#include "system/atomic.h"#include "develop/develop.h"
Include dependency graph for masks_history.c: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 (dt_develop_t *dev, dt_masks_form_t *form) |
| void | dt_masks_replace_current_forms (dt_develop_t *dev, GList *forms) |
| GList * | dt_masks_snapshot_current_forms (dt_develop_t *dev, gboolean reset_changed) |
| void | dt_masks_release_all_forms (dt_develop_t *dev) |
| dt_masks_form_t * dt_masks_cow_touch | ( | struct dt_develop_t * | dev, |
| struct 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 40 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(), _dt_masks_events_mouse_moved(), _masks_move_up_down_callback(), _masks_remove_or_delete_finish(), _masks_remove_shape(), _menu_add_exist(), _resolve_member(), _tree_add_exist(), _tree_add_to_group(), _tree_movedown(), _tree_moveup(), _tree_row_add_to_group(), _tree_row_assign_to_modules(), dt_masks_events_button_pressed(), dt_masks_events_button_released(), dt_masks_events_key_pressed(), dt_masks_events_mouse_scrolled(), dt_masks_form_delete(), dt_masks_form_duplicate_in_group(), dt_masks_form_set_interaction_value(), dt_masks_group_set_name_from_module(), 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 | ( | struct dt_masks_form_t * | form | ) |
take a reference on a form (increments its refcount); returns the same pointer
Definition at line 26 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 | ( | struct 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 33 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 _a_shared_group_is_cloned_before_its_opacity_changes(), _time_overlay_group(), _tree_selection_change(), dt_dev_free_history_item(), dt_dev_history_item_update_from_params(), dt_dev_pixelpipe_cleanup(), dt_dev_pixelpipe_process(), dt_masks_change_form_gui(), dt_masks_cow_touch(), dt_masks_release_all_forms(), dt_masks_remove_form(), and dt_masks_replace_current_forms().
| void dt_masks_release_all_forms | ( | struct dt_develop_t * | dev | ) |
Release every reference this dev holds on any form, and empty both lists.
dev->forms and dev->allforms are INDEPENDENT claims on possibly-shared objects (dt_masks_append_form() and dt_masks_create_ext() each take their own reference), so both are released and neither is unconditionally freed: a form referenced by both only reaches refcount 0 once.
Takes dev->masks_mutex as writer itself – do NOT wrap the call in one. That mistake is silent rather than a deadlock, because dt_pthread_rwlock_t tracks same-thread recursive writers, so it would leave a trap for the next reader rather than a failure.
Does not touch dev->form_gui: that is the GUI's object, torn down by dt_masks_gui_cleanup().
Definition at line 117 of file masks_history.c.
References dt_develop_t::allforms, dt_masks_form_unref(), dt_pthread_rwlock_unlock(), dt_pthread_rwlock_wrlock(), dt_develop_t::forms, IS_NULL_PTR, dt_develop_t::masks_mutex, and void().
Referenced by _studio_dev_teardown(), dt_dev_cleanup(), and leave().
| 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 69 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_dev_snapshot_capture(), 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 103 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().