42 switch (buffer.ownership) {
53 buffer.data =
nullptr;
74 dds_data.
data =
nullptr;
80template<
class BufferType>
85 const size_t type_size,
86 bool initialize_pixels)
88 buffer.data =
static_cast<decltype(BufferType::data)
>(
107 switch (buffer.ownership) {
109 buffer.data =
static_cast<decltype(BufferType::data)
>(
MEM_dupallocN(buffer.data));
117template<
class BufferType>
124 switch (buffer.ownership) {
126 BLI_assert_msg(
false,
"Unexpected behavior: stealing non-owned data pointer");
130 decltype(BufferType::data)
data = buffer.data;
132 buffer.data =
nullptr;
146 if (ibuf ==
nullptr) {
155 if (ibuf ==
nullptr) {
164 if (ibuf ==
nullptr) {
195 if (ibuf ==
nullptr) {
203 "'.blend' relative \"//\" must not be used in ImBuf!");
221 if (ibuf ==
nullptr) {
241 if (ibuf ==
nullptr) {
266 if (ibuf ==
nullptr) {
276 newsize = std::max<uint>(newsize, 10000);
300 uint x,
uint y,
uint channels,
size_t typesize,
bool initialize_pixels,
const char *alloc_name)
308 size_t size = size_t(
x) * size_t(
y) * size_t(channels) * typesize;
314 if (ibuf ==
nullptr) {
323 ibuf->
float_buffer, ibuf->
x, ibuf->
y, channels,
sizeof(
float), initialize_pixels))
338 if (ibuf ==
nullptr) {
345 ibuf->
byte_buffer, ibuf->
x, ibuf->
y, 4,
sizeof(uint8_t), initialize_pixels))
444 uint8_t *byte_buffer,
float *float_buffer,
uint w,
uint h,
uint channels)
446 if (!(byte_buffer || float_buffer)) {
470 const uint8_t *byte_buffer,
const float *float_buffer,
uint w,
uint h,
uint channels)
472 ImBuf *ibuf =
nullptr;
474 if (!(byte_buffer || float_buffer)) {
556 if (ibuf1 ==
nullptr) {
568 if (ibuf2 ==
nullptr) {
587 size_t(ibuf2->
channels) *
x *
y *
sizeof(
float));
632 return size_t(ibuf->
x) * size_t(ibuf->
y);
637 size_t size = 0, channel_size = 0;
642 channel_size +=
sizeof(char);
646 channel_size +=
sizeof(
float);
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
void BLI_kdtree_nd_ free(KDTree *tree)
#define CLOG_ERROR(clg_ref,...)
void GPU_texture_free(blender::gpu::Texture *texture)
@ IB_DO_NOT_TAKE_OWNERSHIP
@ IB_uninitialized_pixels
Read Guarded memory(de)allocation.
void IMB_free_gpu_textures(ImBuf *ibuf)
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)
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_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)
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
blender::gpu::Texture * texture
char filepath[IMB_FILEPATH_SIZE]
ImBufFloatBuffer float_buffer
ImbFormatOptions foptions
ImBufByteBuffer byte_buffer
unsigned int encoded_buffer_size
unsigned int * display_buffer_flags
ColormanageCache * colormanage_cache
ImBufByteBuffer encoded_buffer
unsigned int encoded_size