62 switch (buffer.ownership) {
73 buffer.data =
nullptr;
94 dds_data.
data =
nullptr;
100template<
class BufferType>
105 const size_t type_size,
106 bool initialize_pixels)
108 buffer.data =
static_cast<decltype(BufferType::data)
>(
127 switch (buffer.ownership) {
129 buffer.data =
static_cast<decltype(BufferType::data)
>(
MEM_dupallocN(buffer.data));
137template<
class BufferType>
144 switch (buffer.ownership) {
146 BLI_assert_msg(
false,
"Unexpected behavior: stealing non-owned data pointer");
150 decltype(BufferType::data)
data = buffer.data;
152 buffer.data =
nullptr;
171 if (ibuf->
mipmap[a] !=
nullptr) {
173 ibuf->
mipmap[a] =
nullptr;
182 if (ibuf ==
nullptr) {
195 if (ibuf ==
nullptr) {
208 if (ibuf ==
nullptr) {
239 if (ibuf ==
nullptr) {
247 "'.blend' relative \"//\" must not be used in ImBuf!");
265 if (ibuf ==
nullptr) {
285 if (ibuf ==
nullptr) {
310 if (ibuf ==
nullptr) {
315 printf(
"%s: error in parameters\n", __func__);
320 newsize = std::max<uint>(newsize, 10000);
344 uint x,
uint y,
uint channels,
size_t typesize,
bool initialize_pixels,
const char *alloc_name)
352 size_t size = size_t(
x) * size_t(
y) * size_t(channels) * typesize;
358 if (ibuf ==
nullptr) {
370 ibuf->
float_buffer, ibuf->
x, ibuf->
y, channels,
sizeof(
float), initialize_pixels))
385 if (ibuf ==
nullptr) {
394 ibuf->
byte_buffer, ibuf->
x, ibuf->
y, 4,
sizeof(uint8_t), initialize_pixels))
493 uint8_t *byte_buffer,
float *float_buffer,
uint w,
uint h,
uint channels)
495 if (!(byte_buffer || float_buffer)) {
519 const uint8_t *byte_buffer,
const float *float_buffer,
uint w,
uint h,
uint channels)
521 ImBuf *ibuf =
nullptr;
523 if (!(byte_buffer || float_buffer)) {
605 if (ibuf1 ==
nullptr) {
617 if (ibuf2 ==
nullptr) {
636 size_t(ibuf2->
channels) *
x *
y *
sizeof(
float));
684 return size_t(ibuf->
x) * size_t(ibuf->
y);
690 size_t size = 0, channel_size = 0;
695 channel_size +=
sizeof(char);
699 channel_size +=
sizeof(float);
705 for (a = 0; a < ibuf->
miptot; a++) {
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
void BLI_kdtree_nd_ free(KDTree *tree)
pthread_spinlock_t SpinLock
void BLI_spin_init(SpinLock *spin)
void BLI_spin_unlock(SpinLock *spin)
void BLI_spin_lock(SpinLock *spin)
void BLI_spin_end(SpinLock *spin)
void GPU_texture_free(GPUTexture *texture)
#define IMB_MIPMAP_LEVELS
@ IB_DO_NOT_TAKE_OWNERSHIP
@ IB_uninitialized_pixels
Read Guarded memory(de)allocation.
void IMB_free_gpu_textures(ImBuf *ibuf)
void imb_mmap_lock_exit()
bool IMB_alloc_byte_pixels(ImBuf *ibuf, bool initialize_pixels)
float * IMB_steal_float_buffer(ImBuf *ibuf)
ImBuf * IMB_dupImBuf(const ImBuf *ibuf1)
void IMB_make_writable_byte_buffer(ImBuf *ibuf)
uint8_t * IMB_steal_byte_buffer(ImBuf *ibuf)
static SpinLock mmap_spin
bool IMB_alloc_float_pixels(ImBuf *ibuf, const uint channels, bool initialize_pixels)
bool IMB_initImBuf(ImBuf *ibuf, uint x, uint y, uchar planes, uint flags)
ImBuf * IMB_makeSingleUser(ImBuf *ibuf)
void imb_mmap_lock_init()
void * imb_alloc_pixels(uint x, uint y, uint channels, size_t typesize, bool initialize_pixels, const char *alloc_name)
static void imb_free_dds_buffer(DDSData &dds_data)
void IMB_free_all_data(ImBuf *ibuf)
void IMB_make_writable_float_buffer(ImBuf *ibuf)
bool imb_alloc_buffer(BufferType &buffer, const uint x, const uint y, const uint channels, const size_t type_size, bool initialize_pixels)
ImBuf * IMB_allocImBuf(uint x, uint y, uchar planes, uint flags)
ImBuf * IMB_allocFromBufferOwn(uint8_t *byte_buffer, float *float_buffer, uint w, uint h, uint channels)
bool imb_enlargeencodedbufferImBuf(ImBuf *ibuf)
static void free_encoded_data(ImBuf *ibuf)
void IMB_freeImBuf(ImBuf *ibuf)
size_t IMB_get_pixel_count(const ImBuf *ibuf)
Get the length of the data of the given image buffer in pixels.
void imb_make_writeable_buffer(BufferType &buffer)
void IMB_free_float_pixels(ImBuf *ibuf)
void IMB_refImBuf(ImBuf *ibuf)
void IMB_free_byte_pixels(ImBuf *ibuf)
uint8_t * IMB_steal_encoded_buffer(ImBuf *ibuf)
void IMB_assign_dds_data(ImBuf *ibuf, const DDSData &data, const ImBufOwnership ownership)
auto imb_steal_buffer_data(BufferType &buffer) -> decltype(BufferType::data)
void IMB_assign_byte_buffer(ImBuf *ibuf, uint8_t *buffer_data, const ImBufOwnership ownership)
ImBuf * IMB_allocFromBuffer(const uint8_t *byte_buffer, const float *float_buffer, uint w, uint h, uint channels)
static void imb_free_buffer(BufferType &buffer)
void IMB_free_mipmaps(ImBuf *ibuf)
bool imb_addencodedbufferImBuf(ImBuf *ibuf)
void IMB_assign_float_buffer(ImBuf *ibuf, float *buffer_data, const ImBufOwnership ownership)
size_t IMB_get_size_in_memory(const ImBuf *ibuf)
Provides wrapper around system-specific atomic primitives, and some extensions (faked-atomic operatio...
ATOMIC_INLINE int32_t atomic_add_and_fetch_int32(int32_t *p, int32_t x)
ATOMIC_INLINE int32_t atomic_load_int32(const int32_t *v)
ATOMIC_INLINE int32_t atomic_sub_and_fetch_int32(int32_t *p, int32_t x)
BMesh const char void * data
unsigned long long int uint64_t
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void colormanage_cache_free(ImBuf *ibuf)
void colormanage_imbuf_set_default_spaces(ImBuf *ibuf)
void * MEM_mallocN(size_t len, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
size_t(* MEM_allocN_len)(const void *vmemh)
void MEM_freeN(void *vmemh)
const ColorSpace * colorspace
const ColorSpace * colorspace
char filepath[IMB_FILEPATH_SIZE]
ImBufFloatBuffer float_buffer
ImbFormatOptions foptions
ImBufByteBuffer byte_buffer
ImBuf * mipmap[IMB_MIPMAP_LEVELS]
unsigned int encoded_buffer_size
unsigned int * display_buffer_flags
ColormanageCache * colormanage_cache
ImBufByteBuffer encoded_buffer
unsigned int encoded_size