Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dt_colorspaces_color_profile_t Struct Reference

One registered profile: its identity, its LCMS handle, and where it sits in each combo box. More...

#include <colorspaces.h>

+ Collaboration diagram for dt_colorspaces_color_profile_t:

Data Fields

pthread_rwlock_t lock
 Guards profile, and nothing else in this struct.
 
gboolean owns_profile
 
dt_colorspaces_color_profile_type_t type
 filename is only used for type DT_COLORSPACE_FILE
 
char filename [DT_IOP_COLOR_ICC_LEN]
 icc file name (absolute; compare with dt_colorspaces_is_profile_equal())
 
char name [512]
 product name, displayed in GUI (translated for built-ins)
 
cmsHPROFILE profile
 the actual profile; NULL for the three category entries
 
dt_colorspaces_profile_role_t roles
 Which menus this entry appears in, as a dt_colorspaces_profile_role_t mask.
 

Detailed Description

One registered profile: its identity, its LCMS handle, and where it sits in each combo box.

Entries in the application-wide list are created once at init and freed by dt_colorprofiles_cleanup() (through _colorspaces_destroy(), which closes every profile it finds). The same struct is also used for a container belonging to ONE image – see dt_colorspaces_new_image_profile() – and those set every *_pos to -1 so they are invisible to enumeration by construction.

Warning
Three entries are registered with profile == NULL: the categories DT_COLORSPACE_WORK, DT_COLORSPACE_EXPORT and DT_COLORSPACE_SOFTPROOF, which name a user setting rather than a colour space. Nothing NULL-checks the handle at ~40 call sites that dereference ->profile; what actually keeps them safe is that lookup never gives the category entries a role (see roles), so a category entry can never be returned. Do not "fix" the lookup predicate to consult them a role of their own without auditing those sites first.

Definition at line 201 of file colorspaces.h.

Field Documentation

◆ filename

◆ lock

pthread_rwlock_t dt_colorspaces_color_profile_t::lock

Guards profile, and nothing else in this struct.

TRUE when this container created profile and must close it. FALSE when profile is borrowed from the application-wide list, which owns and closes it – see dt_image_find_best_color_profile(), several of whose branches hand back a pointer into that list rather than a fresh profile. Only per-image containers set this; entries in the application list are freed by dt_colorprofiles_cleanup() as they always were.

Warning
Getting this wrong double-frees on eviction: the image cache closes the handle, then the application list closes it again at shutdown.

Per ENTRY, not per module. Only the DT_COLORSPACE_DISPLAY entry's handle is actually replaced at runtime (by the monitor-profile refresh), but a caller deriving from any profile takes this rather than a module-wide lock, so a thumbnail conversion running against sRGB does not stand between a monitor change and the display entry.

Take it with dt_colorspaces_lock_profile() / dt_colorspaces_unlock_profile(); do not touch it directly. The rest of the struct – type, filename, name, the positions – is fixed at registration and needs no lock.

Definition at line 221 of file colorspaces.h.

Referenced by _create_profile().

◆ name

char dt_colorspaces_color_profile_t::name[512]

product name, displayed in GUI (translated for built-ins)

Definition at line 225 of file colorspaces.h.

Referenced by _colorspaces_build(), _create_profile(), _sort_profiles(), and load_profile_from_dir().

◆ owns_profile

gboolean dt_colorspaces_color_profile_t::owns_profile

Definition at line 222 of file colorspaces.h.

Referenced by dt_colorspaces_new_image_profile().

◆ profile

◆ roles

dt_colorspaces_profile_role_t dt_colorspaces_color_profile_t::roles

Which menus this entry appears in, as a dt_colorspaces_profile_role_t mask.

This used to be five separate int *_pos fields holding a combo-box row number per menu, with -1 meaning "not in this one". Nothing ever read the numbers: every lookup and every enumeration only asked whether one was >= 0. The positions were therefore a second, hand-maintained copy of a fact the list order already carries – enumeration walks the list in registration order, so the k-th entry serving a role IS row k – and keeping them in step meant threading five ++counters through twenty registration calls in the right order.

Zero means no menu, which is what an image-owned container gets (see dt_colorspaces_new_image_profile()) and what makes it unreachable by any lookup. The three category entries are zero too, which is what keeps their profile == NULL away from the call sites that dereference it unchecked.

Definition at line 242 of file colorspaces.h.

Referenced by _colorspaces_build(), _create_profile(), and load_profile_from_dir().

◆ type

dt_colorspaces_color_profile_type_t dt_colorspaces_color_profile_t::type

filename is only used for type DT_COLORSPACE_FILE

Definition at line 223 of file colorspaces.h.

Referenced by _create_profile(), _hash_endpoint(), commit_params(), and load_profile_from_dir().


The documentation for this struct was generated from the following file: