72 switch (buffer.ownership) {
83 buffer.data =
nullptr;
104 dds_data.
data =
nullptr;
110template<
class BufferType>
115 const size_t type_size,
116 bool initialize_pixels)
118 buffer.data =
static_cast<decltype(BufferType::data)
>(
137 switch (buffer.ownership) {
139 buffer.data =
static_cast<decltype(BufferType::data)
>(
MEM_dupallocN(buffer.data));
147template<
class BufferType>
154 switch (buffer.ownership) {
156 BLI_assert_msg(
false,
"Unexpected behavior: stealing non-owned data pointer");
160 decltype(BufferType::data) data = buffer.data;
162 buffer.data =
nullptr;
181 if (ibuf->
mipmap[a] !=
nullptr) {
183 ibuf->
mipmap[a] =
nullptr;
192 if (ibuf ==
nullptr) {
200 ibuf->
flags &= ~IB_rectfloat;
205 if (ibuf ==
nullptr) {
213 ibuf->
flags &= ~IB_rect;
218 if (ibuf ==
nullptr) {
227 ibuf->
flags &= ~IB_mem;
249 if (ibuf ==
nullptr) {
253 bool needs_free =
false;
267 "'.blend' relative \"//\" must not be used in ImBuf!");
287 if (ibuf ==
nullptr) {
292 const bool is_single = (ibuf->
refcounter == 0);
309 if (ibuf ==
nullptr) {
334 if (ibuf ==
nullptr) {
339 printf(
"%s: error in parameters\n", __func__);
344 if (newsize < 10000) {
370 uint x,
uint y,
uint channels,
size_t typesize,
bool initialize_pixels,
const char *alloc_name)
378 size_t size = size_t(x) * size_t(y) * size_t(channels) * typesize;
384 if (ibuf ==
nullptr) {
396 ibuf->
float_buffer, ibuf->
x, ibuf->
y, channels,
sizeof(
float), initialize_pixels))
411 if (ibuf ==
nullptr) {
433 ibuf->
flags &= ~IB_rect;
440 ibuf->
flags &= ~IB_rectfloat;
451 ibuf->
flags &= ~IB_mem;
469 ibuf->
flags &= ~IB_rect;
482 ibuf->
flags &= ~IB_rectfloat;
521 if (!(byte_buffer || float_buffer)) {
547 ImBuf *ibuf =
nullptr;
549 if (!(byte_buffer || float_buffer)) {
578 ImBuf *ibuf = MEM_cnew<ImBuf>(
"ImBuf_struct");
592 memset(ibuf, 0,
sizeof(
ImBuf));
631 if (ibuf1 ==
nullptr) {
643 if (ibuf2 ==
nullptr) {
662 size_t(ibuf2->
channels) * x * y *
sizeof(
float));
710 return size_t(ibuf->
x) * size_t(ibuf->
y);
716 size_t size = 0, channel_size = 0;
718 size +=
sizeof(
ImBuf);
721 channel_size +=
sizeof(char);
725 channel_size +=
sizeof(
float);
728 size += channel_size * ibuf->
x * ibuf->
y * ibuf->
channels;
731 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)
Contains defines and structs used throughout the imbuf module.
#define IMB_MIPMAP_LEVELS
@ IB_DO_NOT_TAKE_OWNERSHIP
@ IB_uninitialized_pixels
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
void imb_freerectImBuf(ImBuf *ibuf)
void IMB_free_gpu_textures(ImBuf *ibuf)
void imb_mmap_lock_exit()
void imb_freerectfloatImBuf(ImBuf *ibuf)
size_t IMB_get_rect_len(const ImBuf *ibuf)
Get the length of the rect of the given image buffer in terms of pixels.
float * IMB_steal_float_buffer(ImBuf *ibuf)
void imb_refcounter_lock_init()
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_initImBuf(ImBuf *ibuf, uint x, uint y, uchar planes, uint flags)
ImBuf * IMB_makeSingleUser(ImBuf *ibuf)
void imb_freerectImbuf_all(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_freemipmapImBuf(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)
void imb_refcounter_lock_exit()
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)
bool imb_addrectImBuf(ImBuf *ibuf, bool initialize_pixels)
void IMB_freeImBuf(ImBuf *ibuf)
void imb_make_writeable_buffer(BufferType &buffer)
void IMB_refImBuf(ImBuf *ibuf)
static SpinLock refcounter_spin
uint8_t * IMB_steal_encoded_buffer(ImBuf *ibuf)
bool imb_addrectfloatImBuf(ImBuf *ibuf, const uint channels, bool initialize_pixels)
static void freeencodedbufferImBuf(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)
size_t IMB_get_size_in_memory(ImBuf *ibuf)
bool imb_addencodedbufferImBuf(ImBuf *ibuf)
void IMB_assign_float_buffer(ImBuf *ibuf, float *buffer_data, const ImBufOwnership ownership)
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)
draw_view in_light_buf[] float
void *(* MEM_mallocN)(size_t len, const char *str)
size_t(* MEM_allocN_len)(const void *vmemh)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_dupallocN)(const void *vmemh)
unsigned __int64 uint64_t
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