![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Stroke-level path processing and raster dispatch for drawlayer. More...
#include "iop/drawlayer/paint.h"#include "iop/drawlayer/cache.h"#include "iop/drawlayer/brush_profile.h"#include "common/darktable.h"#include "common/math.h"#include "develop/noise_generator.h"#include <string.h>
Include dependency graph for iop/drawlayer/paint.c:Functions | |
| static float | _clamp01 (const float v) |
| Clamp scalar value to [0, 1]. | |
| static float | _lerpf (const float a, const float b, const float t) |
| Linear interpolation helper. | |
| static float | _paint_voronoi_strip_angle_measure (const float rho, const float strip_ratio) |
| Compute angular measure used by strip-based profile integration. | |
| static float | _paint_dab_sample_spacing (const dt_drawlayer_brush_dab_t *dab, const float distance_percent) |
| Resolve dab-to-dab center spacing from radius and distance percentage. | |
| static float | _paint_segment_sample_spacing (const dt_drawlayer_brush_dab_t *dabs, const int count, const float distance_percent) |
| Resolve one segment spacing target from edge dab radii. | |
| static float | _paint_cubic_hermitef (const float p0, const float p1, const float m0, const float m1, const float t) |
| Cubic Hermite scalar interpolation helper. | |
| static dt_drawlayer_brush_dab_t | _paint_build_segment_window_sample (const dt_drawlayer_brush_dab_t *dabs, const int count, const float t) |
| Build one interpolated dab sample in the current segment window. | |
| static float | _paint_stroke_sample_opacity_scale (const dt_drawlayer_brush_dab_t *dab, const float sample_step) |
| Compute per-sample opacity normalization from spacing. | |
| static gboolean | _ensure_raw_inputs (dt_drawlayer_paint_stroke_t *state) |
| Lazily allocate raw-input queue storage for one stroke state. | |
| static gboolean | _ensure_pending_dabs (dt_drawlayer_paint_stroke_t *state) |
| Lazily allocate pending-dab batch storage for one stroke state. | |
| static dt_drawlayer_brush_dab_t | _sample_raw_segment_cubic_param (const dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_brush_dab_t *segment_start, const dt_drawlayer_brush_dab_t *segment_end, const float t) |
Sample the current raw segment at parametric position t. | |
| static void | _build_raw_segment_cubic_arclen_lut (const dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_brush_dab_t *segment_start, const dt_drawlayer_brush_dab_t *segment_end, float *cumulative, const int segments, float *total_len) |
| Build arc-length lookup for the current cubic segment. | |
| static dt_drawlayer_brush_dab_t | _sample_raw_segment_cubic_arclen (const dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_brush_dab_t *segment_start, const dt_drawlayer_brush_dab_t *segment_end, const float target_norm, const float *cumulative, const int segments, const float total_len) |
| Sample a cubic segment at normalized arc length using LUT inversion. | |
| static void | _apply_quadratic_dab_smoothing (dt_drawlayer_paint_stroke_t *state, dt_drawlayer_brush_dab_t *dab, const float sample_spacing, const float smoothing_percent, const dt_drawlayer_paint_layer_to_widget_cb layer_to_widget, void *user_data) |
| Apply optional quadratic smoothing to one emitted dab. | |
| static void | _emit_dab (dt_drawlayer_paint_stroke_t *state, dt_drawlayer_brush_dab_t *dab) |
| Emit one dab and append it to emitted-history tracking. | |
| static void | _freeze_emitted_dab_raster_state (dt_drawlayer_brush_dab_t *dab, const float sample_spacing) |
| Freeze raster-time normalization into one emitted dab record. | |
| static void | _enforce_dab_center_spacing (dt_drawlayer_paint_stroke_t *state, dt_drawlayer_brush_dab_t *dab, const float sample_spacing, const dt_drawlayer_paint_layer_to_widget_cb layer_to_widget, void *user_data) |
| Re-project current dab center to exact target spacing from previous dab. | |
| static void | _paint_reset_path_runtime_state (dt_drawlayer_paint_stroke_t *state) |
| Reset only path-generation state while keeping reusable allocations. | |
| void | dt_drawlayer_paint_path_state_reset (dt_drawlayer_paint_stroke_t *state) |
| Reset full stroke state including queued raw input events. | |
| static gboolean | _paint_input_starts_new_stroke (const dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_paint_raw_input_t *input) |
| Test if current input denotes a new stroke boundary. | |
| static uint64_t | _paint_make_stroke_seed (const dt_drawlayer_paint_raw_input_t *input) |
| Build deterministic stroke seed from batch/time/coordinates. | |
| static void | _emit_first_sample_if_needed (dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_brush_dab_t *dab, const dt_drawlayer_paint_callbacks_t *callbacks, void *user_data) |
| Optionally emit first sample immediately when stroke starts. | |
| void | dt_drawlayer_paint_finalize_path (dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_paint_callbacks_t *callbacks, void *user_data) |
| Finalize stroke by force-emitting the pending first sample if needed. | |
| static void | _flush_pending_initial_if_needed (dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_brush_dab_t *dab, const dt_drawlayer_paint_callbacks_t *callbacks, void *user_data) |
| Flush deferred initial dab before regular segment emission starts. | |
| static void | _paint_process_one_raw_input (dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_paint_raw_input_t *input, const dt_drawlayer_paint_callbacks_t *callbacks, void *user_data) |
| Process one raw input event into zero or more emitted dabs. | |
| gboolean | dt_drawlayer_paint_queue_raw_input (dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_paint_raw_input_t *input) |
| Queue one raw input event (FIFO). | |
| static void | _paint_compact_raw_input_queue (dt_drawlayer_paint_stroke_t *state) |
| void | dt_drawlayer_paint_interpolate_path (dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_paint_callbacks_t *callbacks, void *user_data) |
Drain queued raw input events and append evenly spaced dabs to state->pending_dabs. | |
| gboolean | dt_drawlayer_paint_raster_path (const GArray *dabs, const float distance_percent, dt_drawlayer_cache_patch_t *patch, const float scale, dt_drawlayer_cache_patch_t *stroke_mask, dt_drawlayer_damaged_rect_t *runtime_state, dt_drawlayer_paint_stroke_t *runtime_private) |
| Rasterize a precomputed dab list into one float RGBA patch. | |
| static void | _advance_smudge_pickup_state (dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_brush_dab_t *current, const dt_drawlayer_brush_dab_t *previous) |
| gboolean | dt_drawlayer_paint_rasterize_segment_to_buffer (const dt_drawlayer_brush_dab_t *dab, const float distance_percent, dt_drawlayer_cache_patch_t *patch, const float scale, dt_drawlayer_cache_patch_t *stroke_mask, dt_drawlayer_damaged_rect_t *runtime_state, dt_drawlayer_paint_stroke_t *runtime_private) |
| Replay one emitted dab segment into a float buffer through brush API. | |
| dt_drawlayer_damaged_rect_t * | dt_drawlayer_paint_runtime_state_create (void) |
| Allocate zero-initialized stroke-damage accumulator state. | |
| void | dt_drawlayer_paint_runtime_state_destroy (dt_drawlayer_damaged_rect_t **state) |
| Destroy stroke-damage accumulator state and null pointer. | |
| void | dt_drawlayer_paint_runtime_state_reset (dt_drawlayer_damaged_rect_t *state) |
| Reset stroke-damage accumulator to empty/invalid. | |
| dt_drawlayer_paint_stroke_t * | dt_drawlayer_paint_runtime_private_create (void) |
| Allocate stroke runtime payload object used by paint+brush internals. | |
| void | dt_drawlayer_paint_runtime_private_destroy (dt_drawlayer_paint_stroke_t **state) |
| Destroy stroke runtime payload and null pointer. | |
| void | dt_drawlayer_paint_runtime_private_reset (dt_drawlayer_paint_stroke_t *state) |
| Reset transient stroke runtime payload between strokes. | |
| void | dt_drawlayer_paint_runtime_set_stroke_seed (dt_drawlayer_paint_stroke_t *state, const uint64_t seed) |
| Set deterministic stroke seed for noise-derived effects. | |
| uint64_t | dt_drawlayer_paint_runtime_get_stroke_seed (const dt_drawlayer_paint_stroke_t *state) |
| Get current deterministic stroke seed. | |
| gboolean | dt_drawlayer_paint_runtime_ensure_smudge_pixels (dt_drawlayer_paint_stroke_t *state, const int width, const int height) |
| Ensure smudge carry buffer allocation for given footprint dimensions. | |
| float * | dt_drawlayer_paint_runtime_smudge_pixels (dt_drawlayer_paint_stroke_t *state) |
| Get smudge carry buffer pointer (RGBA float). | |
| int | dt_drawlayer_paint_runtime_smudge_width (const dt_drawlayer_paint_stroke_t *state) |
| Get smudge carry buffer width. | |
| int | dt_drawlayer_paint_runtime_smudge_height (const dt_drawlayer_paint_stroke_t *state) |
| Get smudge carry buffer height. | |
| gboolean | dt_drawlayer_paint_runtime_have_smudge_pickup (const dt_drawlayer_paint_stroke_t *state) |
| Query whether smudge pickup coordinates are initialized. | |
| void | dt_drawlayer_paint_runtime_get_smudge_pickup (const dt_drawlayer_paint_stroke_t *state, float *x, float *y) |
| Read smudge pickup coordinates. | |
| void | dt_drawlayer_paint_runtime_set_smudge_pickup (dt_drawlayer_paint_stroke_t *state, const float x, const float y, const gboolean have_pickup) |
| Write smudge pickup coordinates and validity flag. | |
| gboolean | dt_drawlayer_paint_runtime_prepare_dab_context (dt_drawlayer_paint_stroke_t *state, const dt_drawlayer_brush_dab_t *dab, const int width, const int height, const int origin_x, const int origin_y, const float scale) |
| Compute current dab footprint bounds in target buffer coordinates. | |
| void | dt_drawlayer_paint_runtime_note_dab_damage (dt_drawlayer_damaged_rect_t *state, const dt_drawlayer_damaged_rect_t *dab_rect) |
| Merge one dab rectangle into an accumulator rectangle. | |
| gboolean | dt_drawlayer_paint_runtime_get_stroke_damage (const dt_drawlayer_damaged_rect_t *state, dt_drawlayer_damaged_rect_t *out_rect) |
| Read accumulated stroke damage rectangle. | |
| static void | _paint_union_damage_rect (dt_drawlayer_damaged_rect_t *rect, const dt_drawlayer_damaged_rect_t *add_rect) |
| gboolean | dt_drawlayer_paint_merge_runtime_stroke_damage (dt_drawlayer_damaged_rect_t *path_state, dt_drawlayer_damaged_rect_t *target_rect) |
| Merge path-state damage into target rectangle and clear path-state accumulator. | |
Stroke-level path processing and raster dispatch for drawlayer.
|
inlinestatic |
References _lerpf(), dt_drawlayer_paint_runtime_get_smudge_pickup(), dt_drawlayer_paint_runtime_have_smudge_pickup(), dt_drawlayer_paint_runtime_set_smudge_pickup(), dt_drawlayer_brush_dab_t::radius, TRUE, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by dt_drawlayer_paint_rasterize_segment_to_buffer().
|
static |
Apply optional quadratic smoothing to one emitted dab.
Blends prediction with real position and properties.
References _clamp01(), _lerpf(), dt_drawlayer_brush_dab_t::color, dt_drawlayer_brush_dab_t::display_color, dot(), dt_drawlayer_brush_dab_t::flow, h, dt_drawlayer_brush_dab_t::hardness, dt_drawlayer_paint_stroke_t::history, n, dt_drawlayer_brush_dab_t::opacity, dt_drawlayer_brush_dab_t::radius, dt_drawlayer_brush_dab_t::sprinkle_coarseness, dt_drawlayer_brush_dab_t::sprinkle_size, dt_drawlayer_brush_dab_t::sprinkles, dt_drawlayer_brush_dab_t::wx, dt_drawlayer_brush_dab_t::wy, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by _paint_process_one_raw_input().
|
static |
Build arc-length lookup for the current cubic segment.
cumulative must contain segments + 1 items. References _sample_raw_segment_cubic_param(), i, t, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by _paint_process_one_raw_input().
|
inlinestatic |
Clamp scalar value to [0, 1].
References v.
Referenced by _apply_quadratic_dab_smoothing(), _emit_first_sample_if_needed(), _paint_build_segment_window_sample(), _paint_dab_sample_spacing(), _paint_process_one_raw_input(), _paint_stroke_sample_opacity_scale(), _paint_voronoi_strip_angle_measure(), _sample_raw_segment_cubic_arclen(), _sample_raw_segment_cubic_param(), dt_drawlayer_paint_finalize_path(), and dt_drawlayer_paint_rasterize_segment_to_buffer().
|
static |
Emit one dab and append it to emitted-history tracking.
References dt_drawlayer_brush_dab_t::dir_x, dt_drawlayer_brush_dab_t::dir_y, dt_drawlayer_paint_stroke_t::history, dt_drawlayer_paint_stroke_t::pending_dabs, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by _emit_first_sample_if_needed(), _paint_process_one_raw_input(), and dt_drawlayer_paint_finalize_path().
|
static |
Optionally emit first sample immediately when stroke starts.
References _clamp01(), _emit_dab(), _ensure_pending_dabs(), _freeze_emitted_dab_raster_state(), _paint_dab_sample_spacing(), dt_drawlayer_paint_stroke_t::distance_percent, DT_DRAWLAYER_PAINT_STROKE_FIRST, dt_drawlayer_paint_stroke_t::have_last_input_dab, dt_drawlayer_paint_stroke_t::history, dt_drawlayer_paint_stroke_t::last_input_dab, dt_drawlayer_paint_stroke_t::sampled_arc_length, dt_drawlayer_brush_dab_t::stroke_pos, TRUE, and void().
Referenced by _paint_process_one_raw_input().
|
static |
Re-project current dab center to exact target spacing from previous dab.
References d, dt_drawlayer_brush_dab_t::dir_x, dt_drawlayer_brush_dab_t::dir_y, dt_drawlayer_paint_stroke_t::history, dt_drawlayer_brush_dab_t::wx, dt_drawlayer_brush_dab_t::wy, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by _paint_process_one_raw_input().
|
static |
Lazily allocate pending-dab batch storage for one stroke state.
References FALSE, dt_drawlayer_paint_stroke_t::pending_dabs, and TRUE.
Referenced by _emit_first_sample_if_needed(), _paint_process_one_raw_input(), and dt_drawlayer_paint_finalize_path().
|
static |
Lazily allocate raw-input queue storage for one stroke state.
References FALSE, dt_drawlayer_paint_stroke_t::raw_inputs, and TRUE.
Referenced by dt_drawlayer_paint_queue_raw_input().
|
static |
Flush deferred initial dab before regular segment emission starts.
References dt_drawlayer_brush_dab_t::dir_x, dt_drawlayer_brush_dab_t::dir_y, dt_drawlayer_paint_finalize_path(), dt_drawlayer_paint_stroke_t::history, dt_drawlayer_paint_stroke_t::last_input_dab, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by _paint_process_one_raw_input().
|
inlinestatic |
Freeze raster-time normalization into one emitted dab record.
References _paint_stroke_sample_opacity_scale(), dt_drawlayer_brush_dab_t::sample_opacity_scale, and dt_drawlayer_brush_dab_t::sample_spacing.
Referenced by _emit_first_sample_if_needed(), _paint_process_one_raw_input(), and dt_drawlayer_paint_finalize_path().
|
inlinestatic |
Linear interpolation helper.
Referenced by _advance_smudge_pickup_state(), _apply_quadratic_dab_smoothing(), _paint_build_segment_window_sample(), _paint_dab_sample_spacing(), and _sample_raw_segment_cubic_arclen().
|
static |
Build one interpolated dab sample in the current segment window.
Interpolates full dab properties, not just coordinates.
References _clamp01(), _lerpf(), _paint_cubic_hermitef(), dt_drawlayer_brush_dab_t::color, dt_drawlayer_brush_dab_t::dir_x, dt_drawlayer_brush_dab_t::dir_y, dt_drawlayer_brush_dab_t::display_color, dt_simd_set1(), dt_store_simd(), dt_drawlayer_brush_dab_t::flow, dt_drawlayer_brush_dab_t::hardness, dt_drawlayer_brush_dab_t::mode, dt_drawlayer_brush_dab_t::opacity, dt_drawlayer_brush_dab_t::radius, dt_drawlayer_brush_dab_t::shape, dt_drawlayer_brush_dab_t::sprinkle_coarseness, dt_drawlayer_brush_dab_t::sprinkle_size, dt_drawlayer_brush_dab_t::sprinkles, t, dt_drawlayer_brush_dab_t::wx, dt_drawlayer_brush_dab_t::wy, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by _sample_raw_segment_cubic_param().
|
static |
References dt_drawlayer_paint_stroke_t::raw_input_cursor, and dt_drawlayer_paint_stroke_t::raw_inputs.
Referenced by dt_drawlayer_paint_interpolate_path().
|
inlinestatic |
Cubic Hermite scalar interpolation helper.
References t.
Referenced by _paint_build_segment_window_sample().
|
inlinestatic |
Resolve dab-to-dab center spacing from radius and distance percentage.
References _clamp01(), _lerpf(), and dt_drawlayer_brush_dab_t::radius.
Referenced by _emit_first_sample_if_needed(), _paint_segment_sample_spacing(), dt_drawlayer_paint_finalize_path(), and dt_drawlayer_paint_rasterize_segment_to_buffer().
|
static |
Test if current input denotes a new stroke boundary.
References DT_DRAWLAYER_PAINT_STROKE_FIRST, FALSE, dt_drawlayer_paint_stroke_t::have_last_input_dab, dt_drawlayer_paint_stroke_t::last_input_dab, dt_drawlayer_brush_dab_t::stroke_batch, dt_drawlayer_paint_raw_input_t::stroke_batch, and dt_drawlayer_paint_raw_input_t::stroke_pos.
Referenced by _paint_process_one_raw_input().
|
static |
Build deterministic stroke seed from batch/time/coordinates.
References dt_drawlayer_paint_raw_input_t::event_ts, dt_drawlayer_paint_raw_input_t::stroke_batch, dt_drawlayer_paint_raw_input_t::wx, and dt_drawlayer_paint_raw_input_t::wy.
Referenced by _paint_process_one_raw_input().
|
static |
Process one raw input event into zero or more emitted dabs.
Performs cubic arc-length sampling, smoothing and spacing enforcement.
References _apply_quadratic_dab_smoothing(), _build_raw_segment_cubic_arclen_lut(), _clamp01(), _emit_dab(), _emit_first_sample_if_needed(), _enforce_dab_center_spacing(), _ensure_pending_dabs(), _flush_pending_initial_if_needed(), _freeze_emitted_dab_raster_state(), _paint_input_starts_new_stroke(), _paint_make_stroke_seed(), _paint_reset_path_runtime_state(), _paint_segment_sample_spacing(), _sample_raw_segment_cubic_arclen(), dt_drawlayer_paint_callbacks_t::build_dab, dt_drawlayer_paint_raw_input_t::distance_percent, dt_drawlayer_paint_stroke_t::distance_percent, DT_DRAWLAYER_PAINT_STROKE_MIDDLE, dt_drawlayer_paint_stroke_t::have_last_input_dab, dt_drawlayer_paint_stroke_t::have_prev_raw_dab, dt_drawlayer_paint_stroke_t::last_input_dab, dt_drawlayer_paint_callbacks_t::layer_to_widget, dt_drawlayer_paint_callbacks_t::on_stroke_seed, dt_drawlayer_paint_stroke_t::prev_raw_dab, dt_drawlayer_paint_stroke_t::sampled_arc_length, dt_drawlayer_paint_raw_input_t::smoothing_percent, dt_drawlayer_paint_stroke_t::stroke_arc_length, dt_drawlayer_brush_dab_t::stroke_batch, dt_drawlayer_paint_raw_input_t::stroke_batch, dt_drawlayer_brush_dab_t::stroke_pos, dt_drawlayer_paint_stroke_t::stroke_seed, t, TRUE, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by dt_drawlayer_paint_interpolate_path().
|
static |
Reset only path-generation state while keeping reusable allocations.
References dt_drawlayer_paint_stroke_t::dab_window, dt_drawlayer_paint_stroke_t::distance_percent, FALSE, dt_drawlayer_paint_stroke_t::have_last_input_dab, dt_drawlayer_paint_stroke_t::have_prev_raw_dab, dt_drawlayer_paint_stroke_t::history, dt_drawlayer_paint_stroke_t::last_input_dab, dt_drawlayer_paint_stroke_t::pending_dabs, dt_drawlayer_paint_stroke_t::prev_raw_dab, dt_drawlayer_paint_stroke_t::sampled_arc_length, dt_drawlayer_paint_stroke_t::stroke_arc_length, and dt_drawlayer_paint_stroke_t::stroke_seed.
Referenced by _paint_process_one_raw_input(), and dt_drawlayer_paint_path_state_reset().
|
inlinestatic |
Resolve one segment spacing target from edge dab radii.
References _paint_dab_sample_spacing(), and dt_drawlayer_brush_dab_t::radius.
Referenced by _paint_process_one_raw_input().
|
inlinestatic |
Compute per-sample opacity normalization from spacing.
References _clamp01(), _paint_voronoi_strip_angle_measure(), dt_drawlayer_brush_mass_primitive_eval(), dt_drawlayer_brush_profile_eval(), DT_DRAWLAYER_BRUSH_SHAPE_GAUSSIAN, dt_drawlayer_brush_dab_t::hardness, dt_drawlayer_brush_dab_t::radius, and dt_drawlayer_brush_dab_t::shape.
Referenced by _freeze_emitted_dab_raster_state(), and dt_drawlayer_paint_rasterize_segment_to_buffer().
|
inlinestatic |
References MAX, MIN, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_damaged_rect_t::se, and dt_drawlayer_damaged_rect_t::valid.
Referenced by dt_drawlayer_paint_merge_runtime_stroke_damage().
|
inlinestatic |
Compute angular measure used by strip-based profile integration.
References _clamp01().
Referenced by _paint_stroke_sample_opacity_scale().
|
static |
Sample a cubic segment at normalized arc length using LUT inversion.
References _clamp01(), _lerpf(), _sample_raw_segment_cubic_param(), l1, and MIN.
Referenced by _paint_process_one_raw_input().
|
static |
Sample the current raw segment at parametric position t.
References _clamp01(), _paint_build_segment_window_sample(), dt_drawlayer_paint_stroke_t::have_prev_raw_dab, dt_drawlayer_paint_stroke_t::prev_raw_dab, and t.
Referenced by _build_raw_segment_cubic_arclen_lut(), and _sample_raw_segment_cubic_arclen().
| void dt_drawlayer_paint_finalize_path | ( | dt_drawlayer_paint_stroke_t * | state, |
| const dt_drawlayer_paint_callbacks_t * | callbacks, | ||
| void * | user_data | ||
| ) |
Finalize stroke by force-emitting the pending first sample if needed.
Force emission of a pending initial dab when a stroke had no emitted samples yet.
References _clamp01(), _emit_dab(), _ensure_pending_dabs(), _freeze_emitted_dab_raster_state(), _paint_dab_sample_spacing(), dt_drawlayer_paint_stroke_t::distance_percent, DT_DRAWLAYER_PAINT_STROKE_FIRST, dt_drawlayer_paint_stroke_t::have_last_input_dab, dt_drawlayer_paint_stroke_t::history, dt_drawlayer_paint_stroke_t::last_input_dab, dt_drawlayer_paint_stroke_t::sampled_arc_length, dt_drawlayer_brush_dab_t::stroke_pos, and void().
Referenced by _backend_worker_process_stroke_end(), _flush_pending_initial_if_needed(), and dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
| void dt_drawlayer_paint_interpolate_path | ( | dt_drawlayer_paint_stroke_t * | state, |
| const dt_drawlayer_paint_callbacks_t * | callbacks, | ||
| void * | user_data | ||
| ) |
Drain queued raw input events and append evenly spaced dabs to state->pending_dabs.
References _paint_compact_raw_input_queue(), _paint_process_one_raw_input(), dt_drawlayer_paint_stroke_t::raw_input_cursor, and dt_drawlayer_paint_stroke_t::raw_inputs.
Referenced by _process_backend_input(), and dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
| gboolean dt_drawlayer_paint_merge_runtime_stroke_damage | ( | dt_drawlayer_damaged_rect_t * | path_state, |
| dt_drawlayer_damaged_rect_t * | target_rect | ||
| ) |
Merge path-state damage into target rectangle and clear path-state accumulator.
References _paint_union_damage_rect(), dt_drawlayer_paint_runtime_get_stroke_damage(), dt_drawlayer_paint_runtime_state_reset(), FALSE, and TRUE.
Referenced by dt_drawlayer_worker_publish_backend_stroke_damage().
| void dt_drawlayer_paint_path_state_reset | ( | dt_drawlayer_paint_stroke_t * | state | ) |
Reset full stroke state including queued raw input events.
Reset stroke path state and pending raw queue for a new stroke.
References _paint_reset_path_runtime_state(), dt_drawlayer_paint_stroke_t::raw_input_cursor, and dt_drawlayer_paint_stroke_t::raw_inputs.
Referenced by _stroke_begin(), _stroke_clear(), and dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
| gboolean dt_drawlayer_paint_queue_raw_input | ( | dt_drawlayer_paint_stroke_t * | state, |
| const dt_drawlayer_paint_raw_input_t * | input | ||
| ) |
Queue one raw input event (FIFO).
References _ensure_raw_inputs(), FALSE, dt_drawlayer_paint_stroke_t::raw_inputs, and TRUE.
Referenced by _process_backend_input(), and dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
| gboolean dt_drawlayer_paint_raster_path | ( | const GArray * | dabs, |
| const float | distance_percent, | ||
| dt_drawlayer_cache_patch_t * | patch, | ||
| const float | scale, | ||
| dt_drawlayer_cache_patch_t * | stroke_mask, | ||
| dt_drawlayer_damaged_rect_t * | runtime_state, | ||
| dt_drawlayer_paint_stroke_t * | runtime_private | ||
| ) |
Rasterize a precomputed dab list into one float RGBA patch.
References dt_drawlayer_paint_rasterize_segment_to_buffer(), FALSE, and i.
Referenced by dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
| gboolean dt_drawlayer_paint_rasterize_segment_to_buffer | ( | const dt_drawlayer_brush_dab_t * | dab, |
| float | distance_percent, | ||
| dt_drawlayer_cache_patch_t * | patch, | ||
| float | scale, | ||
| dt_drawlayer_cache_patch_t * | stroke_mask, | ||
| dt_drawlayer_damaged_rect_t * | runtime_state, | ||
| dt_drawlayer_paint_stroke_t * | runtime_private | ||
| ) |
Replay one emitted dab segment into a float buffer through brush API.
| dab | Input dab sample from path stream. |
| distance_percent | Sampling distance parameter in [0,1]. |
| patch | Destination float RGBA patch. |
| scale | Layer-to-buffer scale factor. |
| stroke_mask | Optional stroke-local alpha mask patch. |
| runtime_state | Accumulated stroke damage output. |
| runtime_private | Mutable stroke runtime payload. |
References _advance_smudge_pickup_state(), _clamp01(), _paint_dab_sample_spacing(), _paint_stroke_sample_opacity_scale(), dt_drawlayer_paint_stroke_t::bounds, dt_drawlayer_paint_stroke_t::dab_window, darktable, DT_DEBUG_PERF, DT_DEBUG_VERBOSE, DT_DRAWLAYER_BRUSH_MODE_SMUDGE, dt_drawlayer_brush_rasterize(), dt_drawlayer_paint_runtime_note_dab_damage(), dt_drawlayer_paint_runtime_set_smudge_pickup(), DT_DRAWLAYER_PAINT_STROKE_FIRST, dt_get_wtime(), dt_print(), FALSE, MIN, dt_drawlayer_brush_dab_t::mode, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_brush_dab_t::sample_opacity_scale, dt_drawlayer_brush_dab_t::sample_spacing, dt_drawlayer_damaged_rect_t::se, dt_drawlayer_brush_dab_t::stroke_pos, TRUE, darktable_t::unmuted, and dt_drawlayer_damaged_rect_t::valid.
Referenced by _process_backend_dab(), and dt_drawlayer_paint_raster_path().
| gboolean dt_drawlayer_paint_runtime_ensure_smudge_pixels | ( | dt_drawlayer_paint_stroke_t * | state, |
| const int | width, | ||
| const int | height | ||
| ) |
Ensure smudge carry buffer allocation for given footprint dimensions.
References FALSE, height, dt_drawlayer_paint_stroke_t::smudge_height, dt_drawlayer_paint_stroke_t::smudge_pixels, dt_drawlayer_paint_stroke_t::smudge_width, TRUE, and width.
Referenced by dt_drawlayer_brush_rasterize().
| void dt_drawlayer_paint_runtime_get_smudge_pickup | ( | const dt_drawlayer_paint_stroke_t * | state, |
| float * | x, | ||
| float * | y | ||
| ) |
Read smudge pickup coordinates.
References dt_drawlayer_paint_stroke_t::smudge_pickup_x, dt_drawlayer_paint_stroke_t::smudge_pickup_y, and x.
Referenced by _advance_smudge_pickup_state(), and _apply_smudge_stroke_mode().
| gboolean dt_drawlayer_paint_runtime_get_stroke_damage | ( | const dt_drawlayer_damaged_rect_t * | state, |
| dt_drawlayer_damaged_rect_t * | out_rect | ||
| ) |
Read accumulated stroke damage rectangle.
References FALSE, TRUE, and dt_drawlayer_damaged_rect_t::valid.
Referenced by _process_backend_dab(), and dt_drawlayer_paint_merge_runtime_stroke_damage().
| uint64_t dt_drawlayer_paint_runtime_get_stroke_seed | ( | const dt_drawlayer_paint_stroke_t * | state | ) |
Get current deterministic stroke seed.
References dt_drawlayer_paint_stroke_t::stroke_seed.
| gboolean dt_drawlayer_paint_runtime_have_smudge_pickup | ( | const dt_drawlayer_paint_stroke_t * | state | ) |
Query whether smudge pickup coordinates are initialized.
References dt_drawlayer_paint_stroke_t::have_smudge_pickup.
Referenced by _advance_smudge_pickup_state(), and _apply_smudge_stroke_mode().
| void dt_drawlayer_paint_runtime_note_dab_damage | ( | dt_drawlayer_damaged_rect_t * | state, |
| const dt_drawlayer_damaged_rect_t * | dab_rect | ||
| ) |
Merge one dab rectangle into an accumulator rectangle.
References MAX, MIN, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_damaged_rect_t::se, TRUE, and dt_drawlayer_damaged_rect_t::valid.
Referenced by _process_backend_dab(), _rasterize_pending_dab_batch(), dt_drawlayer_paint_rasterize_segment_to_buffer(), dt_drawlayer_process_state_publish_locked(), and dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
| gboolean dt_drawlayer_paint_runtime_prepare_dab_context | ( | dt_drawlayer_paint_stroke_t * | state, |
| const dt_drawlayer_brush_dab_t * | dab, | ||
| const int | width, | ||
| const int | height, | ||
| const int | origin_x, | ||
| const int | origin_y, | ||
| const float | scale | ||
| ) |
Compute current dab footprint bounds in target buffer coordinates.
References dt_drawlayer_paint_stroke_t::bounds, FALSE, height, MAX, MIN, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_brush_dab_t::opacity, dt_drawlayer_brush_dab_t::radius, dt_drawlayer_damaged_rect_t::se, TRUE, dt_drawlayer_damaged_rect_t::valid, width, dt_drawlayer_brush_dab_t::x, and dt_drawlayer_brush_dab_t::y.
Referenced by dt_drawlayer_brush_rasterize().
| dt_drawlayer_paint_stroke_t * dt_drawlayer_paint_runtime_private_create | ( | void | ) |
Allocate stroke runtime payload object used by paint+brush internals.
References dt_drawlayer_paint_runtime_private_reset().
Referenced by _get_fullres_replay_scratch(), and _stroke_create().
| void dt_drawlayer_paint_runtime_private_destroy | ( | dt_drawlayer_paint_stroke_t ** | state | ) |
Destroy stroke runtime payload and null pointer.
Referenced by _destroy_fullres_replay_scratch(), _get_fullres_replay_scratch(), _stroke_create(), and _stroke_destroy().
| void dt_drawlayer_paint_runtime_private_reset | ( | dt_drawlayer_paint_stroke_t * | state | ) |
Reset transient stroke runtime payload between strokes.
References FALSE, dt_drawlayer_paint_stroke_t::have_smudge_pickup, dt_drawlayer_paint_stroke_t::smudge_height, dt_drawlayer_paint_stroke_t::smudge_pickup_x, dt_drawlayer_paint_stroke_t::smudge_pickup_y, dt_drawlayer_paint_stroke_t::smudge_pixels, and dt_drawlayer_paint_stroke_t::smudge_width.
Referenced by _stroke_begin(), _stroke_clear(), dt_drawlayer_paint_runtime_private_create(), and dt_drawlayer_worker_replay_finished_stroke_to_base_patch().
| void dt_drawlayer_paint_runtime_set_smudge_pickup | ( | dt_drawlayer_paint_stroke_t * | state, |
| const float | x, | ||
| const float | y, | ||
| const gboolean | have_pickup | ||
| ) |
Write smudge pickup coordinates and validity flag.
References dt_drawlayer_paint_stroke_t::have_smudge_pickup, dt_drawlayer_paint_stroke_t::smudge_pickup_x, dt_drawlayer_paint_stroke_t::smudge_pickup_y, and x.
Referenced by _advance_smudge_pickup_state(), and dt_drawlayer_paint_rasterize_segment_to_buffer().
| void dt_drawlayer_paint_runtime_set_stroke_seed | ( | dt_drawlayer_paint_stroke_t * | state, |
| const uint64_t | seed | ||
| ) |
Set deterministic stroke seed for noise-derived effects.
References dt_drawlayer_paint_stroke_t::stroke_seed.
Referenced by _paint_stroke_seed_cb().
| int dt_drawlayer_paint_runtime_smudge_height | ( | const dt_drawlayer_paint_stroke_t * | state | ) |
Get smudge carry buffer height.
References dt_drawlayer_paint_stroke_t::smudge_height.
| float * dt_drawlayer_paint_runtime_smudge_pixels | ( | dt_drawlayer_paint_stroke_t * | state | ) |
Get smudge carry buffer pointer (RGBA float).
References dt_drawlayer_paint_stroke_t::smudge_pixels.
Referenced by _apply_smudge_stroke_mode().
| int dt_drawlayer_paint_runtime_smudge_width | ( | const dt_drawlayer_paint_stroke_t * | state | ) |
Get smudge carry buffer width.
References dt_drawlayer_paint_stroke_t::smudge_width.
Referenced by _apply_smudge_stroke_mode().
| dt_drawlayer_damaged_rect_t * dt_drawlayer_paint_runtime_state_create | ( | void | ) |
Allocate zero-initialized stroke-damage accumulator state.
References dt_drawlayer_paint_runtime_state_reset().
Referenced by _rt_init_state().
| void dt_drawlayer_paint_runtime_state_destroy | ( | dt_drawlayer_damaged_rect_t ** | state | ) |
Destroy stroke-damage accumulator state and null pointer.
References dt_free.
Referenced by _rt_destroy_state().
| void dt_drawlayer_paint_runtime_state_reset | ( | dt_drawlayer_damaged_rect_t * | state | ) |
Reset stroke-damage accumulator to empty/invalid.
References FALSE, dt_drawlayer_damaged_rect_t::nw, dt_drawlayer_damaged_rect_t::se, and dt_drawlayer_damaged_rect_t::valid.
Referenced by _process_backend_dab(), _publish_backend_progress(), _reset_backend_path(), _reset_live_publish(), dt_drawlayer_cache_flush_process_patch_to_base(), dt_drawlayer_cache_invalidate_process_patch_state(), dt_drawlayer_cache_populate_process_patch_from_base(), dt_drawlayer_paint_merge_runtime_stroke_damage(), dt_drawlayer_paint_runtime_state_create(), dt_drawlayer_process_state_cleanup(), dt_drawlayer_process_state_init(), dt_drawlayer_process_state_invalidate(), and dt_drawlayer_process_state_reset_stroke().