diff options
Diffstat (limited to 'source/blender/imbuf/intern/allocimbuf.c')
-rw-r--r-- | source/blender/imbuf/intern/allocimbuf.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 3f440c0bf6f..99b3c3a58d6 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -32,6 +32,8 @@ /* It's become a bit messy... Basically, only the IMB_ prefixed files * should remain. */ +#include <stddef.h> + #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -275,7 +277,8 @@ short imb_addrectfloatImBuf(ImBuf *ibuf) if(ibuf==NULL) return FALSE; - imb_freerectfloatImBuf(ibuf); + if(ibuf->rect_float) + imb_freerectfloatImBuf(ibuf); /* frees mipmap too, hrm */ size = ibuf->x *ibuf->y; size = size *4 *sizeof(float); @@ -296,8 +299,12 @@ short imb_addrectImBuf(ImBuf *ibuf) int size; if(ibuf==NULL) return FALSE; - imb_freerectImBuf(ibuf); - + + /* don't call imb_freerectImBuf, it frees mipmaps, this call is used only too give float buffers display */ + if(ibuf->rect && (ibuf->mall & IB_rect)) + MEM_freeN(ibuf->rect); + ibuf->rect= NULL; + size = ibuf->x*ibuf->y; size = size*sizeof(unsigned int); @@ -322,7 +329,7 @@ short imb_addtilesImBuf(ImBuf *ibuf) return (ibuf->tiles != NULL); } -ImBuf *IMB_allocImBuf(short x, short y, uchar d, unsigned int flags, uchar bitmap) /* XXX bitmap argument is deprecated */ +ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar d, unsigned int flags) { ImBuf *ibuf; @@ -382,7 +389,7 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1) y = ibuf1->y; if(ibuf1->flags & IB_fields) y *= 2; - ibuf2 = IMB_allocImBuf(x, y, ibuf1->depth, flags, 0); + ibuf2 = IMB_allocImBuf(x, y, ibuf1->depth, flags); if(ibuf2 == NULL) return NULL; if(flags & IB_rect) @@ -441,7 +448,7 @@ static void imbuf_cache_destructor(void *data) ibuf->c_handle = 0; } -static MEM_CacheLimiterC **get_imbuf_cache_limiter() +static MEM_CacheLimiterC **get_imbuf_cache_limiter(void) { static MEM_CacheLimiterC *c = 0; @@ -451,7 +458,7 @@ static MEM_CacheLimiterC **get_imbuf_cache_limiter() return &c; } -void IMB_free_cache_limiter() +void IMB_free_cache_limiter(void) { delete_MEM_CacheLimiter(*get_imbuf_cache_limiter()); *get_imbuf_cache_limiter() = 0; |