![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Patch/cache helpers for drawlayer process and preview buffers. More...
#include "develop/imageop.h"#include "caches/pixelpipe_cache.h"#include "iop/drawlayer/paint.h"#include <glib.h>#include <stddef.h>#include <stdint.h>
Include dependency graph for iop/drawlayer/cache.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | dt_drawlayer_cache_patch_t |
| Generic float RGBA patch stored either in malloc memory or pixel cache. More... | |
Typedefs | |
| typedef struct dt_drawlayer_cache_patch_t | dt_drawlayer_cache_patch_t |
| Generic float RGBA patch stored either in malloc memory or pixel cache. | |
Functions | |
| void * | dt_drawlayer_cache_alloc_temp_buffer (size_t bytes, const char *name) |
| Allocate a temporary RGBA scratch buffer. | |
| void | dt_drawlayer_cache_free_temp_buffer (void **buffer, const char *name) |
| Release temporary scratch buffer allocated by cache helpers. | |
| float * | dt_drawlayer_cache_ensure_scratch_buffer (float **buffer, size_t *capacity_pixels, size_t needed_pixels, const char *name) |
| Ensure a float RGBA scratch buffer capacity in pixels. | |
| void | dt_drawlayer_cache_clear_transparent_float (float *pixels, size_t pixel_count) |
| Fill RGBA float buffer with transparent black. | |
| void | dt_drawlayer_cache_patch_clear (dt_drawlayer_cache_patch_t *patch, const char *external_alloc_name) |
| Drop patch storage and clear metadata. | |
| gboolean | dt_drawlayer_cache_patch_alloc_shared (dt_drawlayer_cache_patch_t *patch, uint64_t hash, size_t pixel_count, int width, int height, const char *name, int *created_out) |
| Allocate/reuse shared patch storage from pixel cache. | |
| gboolean | dt_drawlayer_cache_ensure_mask_buffer (dt_drawlayer_cache_patch_t *mask, int width, int height, const char *name) |
| Ensure a float stroke-mask buffer exists for 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, int width, int height, const char *patch_buffer_name, const char *mask_buffer_name) |
| Ensure process patch and its stroke mask buffers are allocated. | |
Patch/cache helpers for drawlayer process and preview buffers.
Definition in file iop/drawlayer/cache.h.
| typedef struct dt_drawlayer_cache_patch_t dt_drawlayer_cache_patch_t |
Generic float RGBA patch stored either in malloc memory or pixel cache.
| void * dt_drawlayer_cache_alloc_temp_buffer | ( | const size_t | bytes, |
| const char * | name | ||
| ) |
Allocate a temporary RGBA scratch buffer.
Allocate a temporary RGBA scratch buffer.
Definition at line 27 of file src/iop/drawlayer/cache.c.
References DT_DEV_PIXELPIPE_NONE, dt_pixelpipe_cache_alloc_align_cache_impl(), and name.
Referenced by dt_drawlayer_cache_ensure_mask_buffer(), dt_drawlayer_cache_ensure_process_patch_buffer(), dt_drawlayer_cache_ensure_scratch_buffer(), and dt_drawlayer_io_background_layer_job_run().
| void dt_drawlayer_cache_clear_transparent_float | ( | float * | pixels, |
| const size_t | pixel_count | ||
| ) |
Fill RGBA float 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.
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().
| 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 for 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, name, TRUE, and width.
Referenced by dt_drawlayer_ensure_layer_cache().
| 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 its stroke mask buffers are allocated.
Ensure process patch and its stroke mask buffers are allocated.
Definition at line 186 of file src/iop/drawlayer/cache.c.
References dt_drawlayer_cache_patch_t::cache_entry, dt_drawlayer_cache_patch_t::cache_hash, 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, dt_drawlayer_cache_patch_t::external_alloc, FALSE, dt_pixel_cache_entry_t::hash, height, dt_drawlayer_cache_patch_t::height, IS_NULL_PTR, dt_drawlayer_cache_patch_t::pixels, TRUE, width, dt_drawlayer_cache_patch_t::width, dt_drawlayer_cache_patch_t::x, and dt_drawlayer_cache_patch_t::y.
Referenced by _ensure_heartbeat_batch_buffers().
| float * dt_drawlayer_cache_ensure_scratch_buffer | ( | float ** | buffer, |
| size_t * | capacity_pixels, | ||
| const size_t | needed_pixels, | ||
| const char * | name | ||
| ) |
Ensure a float RGBA scratch buffer 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, and name.
Referenced by _blend_layer_over_input_cl(), and process().
Release temporary scratch buffer allocated by cache helpers.
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().
| 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/reuse shared patch storage from pixel cache.
Allocate/reuse shared patch storage from pixel cache.
Definition at line 86 of file src/iop/drawlayer/cache.c.
References dt_drawlayer_cache_patch_t::cache_entry, dt_drawlayer_cache_patch_t::cache_hash, dt_dev_pixelpipe_cache_get(), dt_dev_pixelpipe_cache_ref_count_entry(), dt_dev_pixelpipe_cache_wrlock_entry(), DT_DEV_PIXELPIPE_NONE, dt_drawlayer_cache_patch_clear(), dt_drawlayer_cache_patch_t::external_alloc, FALSE, hash, height, dt_drawlayer_cache_patch_t::height, IS_NULL_PTR, name, dt_drawlayer_cache_patch_t::pixels, TRUE, width, dt_drawlayer_cache_patch_t::width, dt_drawlayer_cache_patch_t::x, and dt_drawlayer_cache_patch_t::y.
Referenced by __attribute__(), dt_drawlayer_ensure_layer_cache(), and dt_drawlayer_rekey_shared_base_patch().
| void dt_drawlayer_cache_patch_clear | ( | dt_drawlayer_cache_patch_t * | patch, |
| const char * | external_alloc_name | ||
| ) |
Drop patch storage and clear metadata.
Drop patch storage and clear metadata.
Definition at line 64 of file src/iop/drawlayer/cache.c.
References dt_drawlayer_cache_patch_t::cache_entry, dt_dev_pixelpipe_cache_ref_count_entry(), dt_free, dt_pixelpipe_cache_free_align_cache(), dt_drawlayer_cache_patch_t::external_alloc, FALSE, IS_NULL_PTR, and dt_drawlayer_cache_patch_t::pixels.
Referenced by __attribute__(), _delete_current_layer(), _rt_destroy_state(), dt_drawlayer_cache_ensure_mask_buffer(), dt_drawlayer_cache_ensure_process_patch_buffer(), dt_drawlayer_cache_patch_alloc_shared(), dt_drawlayer_ensure_layer_cache(), dt_drawlayer_process_state_cleanup(), dt_drawlayer_process_state_invalidate(), dt_drawlayer_rekey_shared_base_patch(), and dt_drawlayer_runtime_manager_update().
| void dt_drawlayer_cache_patch_rdlock | ( | const dt_drawlayer_cache_patch_t * | patch | ) |
Acquire read lock on shared patch cache entry.
Definition at line 158 of file src/iop/drawlayer/cache.c.
References dt_drawlayer_cache_patch_t::cache_entry, dt_dev_pixelpipe_cache_rdlock_entry(), IS_NULL_PTR, and TRUE.
Referenced by _rasterize_pending_dab_batch(), dt_drawlayer_flush_layer_cache(), and dt_drawlayer_rekey_shared_base_patch().
| void dt_drawlayer_cache_patch_rdunlock | ( | const dt_drawlayer_cache_patch_t * | patch | ) |
Release read lock on shared patch cache entry.
Definition at line 165 of file src/iop/drawlayer/cache.c.
References dt_drawlayer_cache_patch_t::cache_entry, dt_dev_pixelpipe_cache_rdlock_entry(), FALSE, and IS_NULL_PTR.
Referenced by _rasterize_pending_dab_batch(), _release_runtime_source(), dt_drawlayer_flush_layer_cache(), and dt_drawlayer_rekey_shared_base_patch().
| void dt_drawlayer_cache_patch_wrlock | ( | const dt_drawlayer_cache_patch_t * | patch | ) |
Acquire write lock on shared patch cache entry.
Definition at line 172 of file src/iop/drawlayer/cache.c.
References dt_drawlayer_cache_patch_t::cache_entry, dt_dev_pixelpipe_cache_wrlock_entry(), IS_NULL_PTR, and TRUE.
Referenced by __attribute__(), _clear_current_layer(), _fill_current_layer(), _rasterize_pending_dab_batch(), and dt_drawlayer_ensure_layer_cache().
| void dt_drawlayer_cache_patch_wrunlock | ( | const dt_drawlayer_cache_patch_t * | patch | ) |
Release write lock on shared patch cache entry.
Definition at line 179 of file src/iop/drawlayer/cache.c.
References dt_drawlayer_cache_patch_t::cache_entry, dt_dev_pixelpipe_cache_wrlock_entry(), FALSE, and IS_NULL_PTR.
Referenced by __attribute__(), _clear_current_layer(), _fill_current_layer(), _rasterize_pending_dab_batch(), and dt_drawlayer_ensure_layer_cache().