Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
masks_touched.h File Reference
#include <string.h>
#include "pixel/format.h"
+ Include dependency graph for masks_touched.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static void dt_masks_touched_none (dt_iop_roi_t *touched)
 
static void dt_masks_touched_full (dt_iop_roi_t *touched, const int width, const int height)
 
static void dt_masks_touched_set (dt_iop_roi_t *touched, int x0, int y0, int x1, int y1, const int width, const int height)
 
static int dt_masks_touched_is_empty (const dt_iop_roi_t *touched)
 
static void dt_masks_touched_union (dt_iop_roi_t *into, const dt_iop_roi_t *other)
 
static void dt_masks_touched_clear (float *const buffer, const int width, const dt_iop_roi_t *touched)
 

Function Documentation

◆ dt_masks_touched_clear()

static void dt_masks_touched_clear ( float *const  buffer,
const int  width,
const dt_iop_roi_t touched 
)
inlinestatic

Zero a rectangle of a width-strided float buffer.

Definition at line 110 of file masks_touched.h.

References dt_masks_touched_is_empty(), dt_iop_roi_t::height, width, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.

Referenced by _group_get_mask_roi().

◆ dt_masks_touched_full()

static void dt_masks_touched_full ( dt_iop_roi_t touched,
const int  width,
const int  height 
)
inlinestatic

◆ dt_masks_touched_is_empty()

static int dt_masks_touched_is_empty ( const dt_iop_roi_t touched)
inlinestatic

◆ dt_masks_touched_none()

static void dt_masks_touched_none ( dt_iop_roi_t touched)
inlinestatic

The rectangle a shape rasteriser actually wrote, in BUFFER-RELATIVE pixels.

Every get_mask_roi implementation reports it through its touched out-parameter (a dt_iop_roi_t, scale unused) so the group fold can zero and combine only what the shape covers instead of the whole ROI once per shape. width == 0 || height == 0 means the shape wrote nothing. A rasteriser that cannot bound its writes reports the full buffer, which is always correct and merely costs what it cost before.

The contract is "encloses every pixel written": a box larger than the writes is fine, a box smaller is a wrong mask, since the fold will not look outside it.

Definition at line 39 of file masks_touched.h.

References dt_iop_roi_t::height, dt_iop_roi_t::scale, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.

Referenced by _brush_get_mask_roi(), _circle_get_mask_roi(), _ellipse_get_mask_roi(), _gradient_get_mask_roi(), _group_get_mask_roi(), _polygon_get_mask_roi(), dt_masks_get_mask_roi(), and dt_masks_touched_set().

◆ dt_masks_touched_set()

static void dt_masks_touched_set ( dt_iop_roi_t touched,
int  x0,
int  y0,
int  x1,
int  y1,
const int  width,
const int  height 
)
inlinestatic

Set from an inclusive pixel span [x0, x1] x [y0, y1], clamped to the buffer. Empty if it falls entirely outside.

Definition at line 61 of file masks_touched.h.

References dt_masks_touched_none(), height, dt_iop_roi_t::height, dt_iop_roi_t::scale, width, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.

Referenced by _brush_get_mask_roi(), _circle_get_mask_roi(), _ellipse_get_mask_roi(), and _polygon_get_mask_roi().

◆ dt_masks_touched_union()

static void dt_masks_touched_union ( dt_iop_roi_t into,
const dt_iop_roi_t other 
)
inlinestatic

Grow into so it also encloses other.

Definition at line 87 of file masks_touched.h.

References dt_masks_touched_is_empty(), dt_iop_roi_t::height, dt_iop_roi_t::width, dt_iop_roi_t::x, and dt_iop_roi_t::y.

Referenced by _group_get_mask_roi().