Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
cache.c File Reference
#include "system/macros.h"
#include "system/mem_alloc.h"
#include "iop/drawlayer/cache.h"
#include <string.h>
+ Include dependency graph for src/iop/drawlayer/cache.c:

Go to the source code of this file.

Functions

void * dt_drawlayer_cache_alloc_temp_buffer (const size_t bytes, const char *name)
 Allocate temporary aligned cache buffer.
 
void dt_drawlayer_cache_free_temp_buffer (void **buffer, const char *name)
 Free temporary aligned cache buffer.
 
float * dt_drawlayer_cache_ensure_scratch_buffer (float **buffer, size_t *capacity_pixels, const size_t needed_pixels, const char *name)
 Ensure scratch RGBA float capacity in pixels.
 
void dt_drawlayer_cache_clear_transparent_float (float *pixels, const size_t pixel_count)
 Fill float RGBA buffer with transparent black.
 
void dt_drawlayer_cache_patch_clear (dt_drawlayer_cache_patch_t *patch, const char *external_alloc_name)
 Release patch storage and reset patch metadata.
 
gboolean dt_drawlayer_cache_patch_alloc_shared (dt_drawlayer_cache_patch_t *patch, const uint64_t hash, const size_t pixel_count, const int width, const int height, const char *name, int *created_out)
 Allocate patch storage from shared pixel cache entry.
 
gboolean dt_drawlayer_cache_ensure_mask_buffer (dt_drawlayer_cache_patch_t *mask, const int width, const int height, const char *name)
 Ensure a float stroke-mask buffer exists and matches the requested size.
 
void dt_drawlayer_cache_patch_rdlock (const dt_drawlayer_cache_patch_t *patch)
 Acquire read lock on shared patch cache entry.
 
void dt_drawlayer_cache_patch_rdunlock (const dt_drawlayer_cache_patch_t *patch)
 Release read lock on shared patch cache entry.
 
void dt_drawlayer_cache_patch_wrlock (const dt_drawlayer_cache_patch_t *patch)
 Acquire write lock on shared patch cache entry.
 
void dt_drawlayer_cache_patch_wrunlock (const dt_drawlayer_cache_patch_t *patch)
 Release write lock on shared patch cache entry.
 
gboolean dt_drawlayer_cache_ensure_process_patch_buffer (dt_drawlayer_cache_patch_t *process_patch, dt_drawlayer_cache_patch_t *process_stroke_mask, const int width, const int height, const char *patch_buffer_name, const char *mask_buffer_name)
 Ensure process patch and process-stroke-mask backing buffers exist.
 

Function Documentation

◆ dt_drawlayer_cache_alloc_temp_buffer()

void * dt_drawlayer_cache_alloc_temp_buffer ( const size_t  bytes,
const char *  name 
)

◆ dt_drawlayer_cache_clear_transparent_float()

void dt_drawlayer_cache_clear_transparent_float ( float *  pixels,
const size_t  pixel_count 
)

Fill float RGBA buffer with transparent black.

Fill RGBA float buffer with transparent black.

Definition at line 57 of file src/iop/drawlayer/cache.c.

References IS_NULL_PTR, and L.

Referenced by __attribute__(), _clear_current_layer(), dt_drawlayer_ensure_layer_cache(), dt_drawlayer_io_background_layer_job_run(), dt_drawlayer_io_load_flat_rgba(), and dt_drawlayer_io_load_layer().

◆ dt_drawlayer_cache_ensure_mask_buffer()

gboolean dt_drawlayer_cache_ensure_mask_buffer ( dt_drawlayer_cache_patch_t *  mask,
const int  width,
const int  height,
const char *  name 
)

Ensure a float stroke-mask buffer exists and matches the requested size.

Ensure a float stroke-mask buffer exists for the requested size.

Definition at line 122 of file src/iop/drawlayer/cache.c.

References dt_dev_pixelpipe_cache_ref_entry_for_host_ptr(), dt_drawlayer_cache_alloc_temp_buffer(), dt_drawlayer_cache_patch_clear(), DT_PIXELPIPE_CACHE_HASH_INVALID, FALSE, height, IS_NULL_PTR, L, name, TRUE, and width.

Referenced by dt_drawlayer_ensure_layer_cache().

◆ dt_drawlayer_cache_ensure_process_patch_buffer()

gboolean dt_drawlayer_cache_ensure_process_patch_buffer ( dt_drawlayer_cache_patch_t *  process_patch,
dt_drawlayer_cache_patch_t *  process_stroke_mask,
const int  width,
const int  height,
const char *  patch_buffer_name,
const char *  mask_buffer_name 
)

Ensure process patch and process-stroke-mask backing buffers exist.

Ensure process patch and its stroke mask buffers are allocated.

Definition at line 186 of file src/iop/drawlayer/cache.c.

References dt_dev_pixelpipe_cache_ref_entry_for_host_ptr(), dt_drawlayer_cache_alloc_temp_buffer(), dt_drawlayer_cache_patch_clear(), DT_PIXELPIPE_CACHE_HASH_INVALID, FALSE, height, IS_NULL_PTR, L, TRUE, and width.

Referenced by _ensure_heartbeat_batch_buffers().

◆ dt_drawlayer_cache_ensure_scratch_buffer()

float * dt_drawlayer_cache_ensure_scratch_buffer ( float **  buffer,
size_t *  capacity_pixels,
const size_t  needed_pixels,
const char *  name 
)

Ensure scratch RGBA float capacity in pixels.

Ensure a float RGBA scratch buffer capacity in pixels.

Definition at line 41 of file src/iop/drawlayer/cache.c.

References dt_drawlayer_cache_alloc_temp_buffer(), dt_drawlayer_cache_free_temp_buffer(), IS_NULL_PTR, L, and name.

Referenced by _blend_layer_over_input_cl(), and process().

◆ dt_drawlayer_cache_free_temp_buffer()

void dt_drawlayer_cache_free_temp_buffer ( void **  buffer,
const char *  name 
)

Free temporary aligned cache buffer.

Release temporary scratch buffer allocated by cache helpers.

Definition at line 34 of file src/iop/drawlayer/cache.c.

References dt_pixelpipe_cache_free_align_cache(), IS_NULL_PTR, and name.

Referenced by _destroy_process_scratch(), dt_drawlayer_cache_ensure_scratch_buffer(), and dt_drawlayer_io_background_layer_job_run().

◆ dt_drawlayer_cache_patch_alloc_shared()

◆ dt_drawlayer_cache_patch_clear()

◆ dt_drawlayer_cache_patch_rdlock()

void dt_drawlayer_cache_patch_rdlock ( const dt_drawlayer_cache_patch_t *  patch)

◆ dt_drawlayer_cache_patch_rdunlock()

◆ dt_drawlayer_cache_patch_wrlock()

◆ dt_drawlayer_cache_patch_wrunlock()