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

Go to the source code of this file.

Data Structures

struct  dt_dev_image_geometry_t
 Objective facts about the image a dev is working on. More...
 
struct  dt_dev_geometry_store_t
 Single-writer seqlock around the record. More...
 

Typedefs

typedef struct dt_dev_image_geometry_t dt_dev_image_geometry_t
 Objective facts about the image a dev is working on.
 
typedef struct dt_dev_geometry_store_t dt_dev_geometry_store_t
 Single-writer seqlock around the record.
 

Functions

void dt_dev_geometry_init (struct dt_develop_t *dev)
 
void dt_dev_geometry_set_raw_size (struct dt_develop_t *dev, int32_t width, int32_t height, gboolean valid)
 
void dt_dev_geometry_set_processed_size (struct dt_develop_t *dev, int32_t width, int32_t height)
 
dt_dev_image_geometry_t dt_dev_geometry_snapshot (const struct dt_develop_t *dev)
 
gboolean dt_dev_geometry_get (const struct dt_develop_t *dev, dt_dev_image_geometry_t *out)
 
gboolean dt_dev_geometry_get_raw_size (const struct dt_develop_t *dev, int32_t *width, int32_t *height)
 
gboolean dt_dev_geometry_get_processed_size (const struct dt_develop_t *dev, int32_t *width, int32_t *height)
 
int32_t dt_dev_geometry_raw_width (const struct dt_develop_t *dev)
 
int32_t dt_dev_geometry_raw_height (const struct dt_develop_t *dev)
 
int32_t dt_dev_geometry_processed_width (const struct dt_develop_t *dev)
 
int32_t dt_dev_geometry_processed_height (const struct dt_develop_t *dev)
 
gboolean dt_dev_geometry_raw_inited (const struct dt_develop_t *dev)
 

Typedef Documentation

◆ dt_dev_geometry_store_t

Single-writer seqlock around the record.

generation is odd while a publication is in flight and even once it has settled. A reader copies the value, re-reads the generation and retries on a mismatch, so a pipeline thread can never observe a new width paired with an old height – which is the failure this record exists to remove, the pair having been two independent unlocked stores before.

Deliberately not a mutex: one here would create a lock-ordering obligation against history_mutex and the pipe's busy_mutex, both of which are already held across reads of these values.

◆ dt_dev_image_geometry_t

Objective facts about the image a dev is working on.

This is not GUI state, and the distinction is not academic. Every field here is needed with no GUI at all: export, thumbnail generation and dev_snapshot's frozen dev all resolve drawn-mask geometry against the raw dimensions, and the darkroom worker feeds them to dt_dev_pixelpipe_set_input() on every loop tick.

Leaving them at zero does not fail loudly. dt_dev_coordinates_raw_norm_to_raw_abs() early-returns on raw_width == 0 WITHOUT transforming, so a shape's normalized centre masquerades as absolute pixel coordinates and every mask on the image collapses to within a few hundred pixels of the origin. That shipped once, because these fields were mistaken for GUI state and written only if(dev->gui_attached). See CLAUDE.md, and do not gate dt_dev_geometry_set_raw_size() on anything.

Function Documentation

◆ dt_dev_geometry_get()

gboolean dt_dev_geometry_get ( const struct dt_develop_t dev,
dt_dev_image_geometry_t out 
)

Out-param form, for callers that also want the "is anything published" answer.

◆ dt_dev_geometry_get_processed_size()

gboolean dt_dev_geometry_get_processed_size ( const struct dt_develop_t dev,
int32_t *  width,
int32_t *  height 
)

Coherent copy of the processed pair. Returns processed_inited, same out-param contract.

◆ dt_dev_geometry_get_raw_size()

gboolean dt_dev_geometry_get_raw_size ( const struct dt_develop_t dev,
int32_t *  width,
int32_t *  height 
)

Coherent copy of the raw pair. Returns raw_inited; the out-params are written either way, so a caller that ignores the result sees exactly today's values.

◆ dt_dev_geometry_init()

void dt_dev_geometry_init ( struct dt_develop_t dev)

Seed the store. Call once, from dt_dev_init(), before anything can read it.

Definition at line 42 of file dev_geometry.c.

References dt_atomic_set_uint64(), dt_dev_geometry_store_t::generation, dt_develop_t::geometry, IS_NULL_PTR, L, and dt_dev_geometry_store_t::value.

Referenced by dt_dev_init().

◆ dt_dev_geometry_processed_height()

int32_t dt_dev_geometry_processed_height ( const struct dt_develop_t dev)

◆ dt_dev_geometry_processed_width()

int32_t dt_dev_geometry_processed_width ( const struct dt_develop_t dev)

◆ dt_dev_geometry_raw_height()

int32_t dt_dev_geometry_raw_height ( const struct dt_develop_t dev)

◆ dt_dev_geometry_raw_inited()

gboolean dt_dev_geometry_raw_inited ( const struct dt_develop_t dev)

◆ dt_dev_geometry_raw_width()

int32_t dt_dev_geometry_raw_width ( const struct dt_develop_t dev)

◆ dt_dev_geometry_set_processed_size()

void dt_dev_geometry_set_processed_size ( struct dt_develop_t dev,
int32_t  width,
int32_t  height 
)

◆ dt_dev_geometry_set_raw_size()

void dt_dev_geometry_set_raw_size ( struct dt_develop_t dev,
int32_t  width,
int32_t  height,
gboolean  valid 
)

◆ dt_dev_geometry_snapshot()

dt_dev_image_geometry_t dt_dev_geometry_snapshot ( const struct dt_develop_t dev)

Coherent copy of the whole record, by value – the ordinary way to read it:

const dt_dev_image_geometry_t geometry = dt_dev_geometry_snapshot(dev);

One seqlock read, then plain member access, so a caller that needs several fields cannot accidentally pair them across a publication. Zeroed, with both _inited bits FALSE, when nothing has been published yet.