diff options
author | Ton Roosendaal <ton@blender.org> | 2006-12-20 20:57:56 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-12-20 20:57:56 +0300 |
commit | 253432bfc7c2a1dae224a03fb3055de19743ec67 (patch) | |
tree | 2cea30606f9f29be51d5366ddf0d3747b9649b90 /source/blender/imbuf/intern/allocimbuf.c | |
parent | 0a0753b409221b66f5003d8c257426043ada227e (diff) |
The Big Image refactor!
Please read:
http://www.blender3d.org/cms/Imaging.834.0.html
Or in short:
- adding MultiLayer Image support
- recoded entire Image API
- better integration of movie/sequence Images
Was a whole load of work... went down for a week to do this. So, will need
a lot of testing! Will be in irc all evening.
Diffstat (limited to 'source/blender/imbuf/intern/allocimbuf.c')
-rw-r--r-- | source/blender/imbuf/intern/allocimbuf.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c index 30e97328e7c..003d377389b 100644 --- a/source/blender/imbuf/intern/allocimbuf.c +++ b/source/blender/imbuf/intern/allocimbuf.c @@ -62,6 +62,17 @@ void imb_freeplanesImBuf(struct ImBuf * ibuf) ibuf->mall &= ~IB_planes; } +void imb_freemipmapImBuf(struct ImBuf * ibuf) +{ + int a; + + for(a=0; a<IB_MIPMAP_LEVELS; a++) { + if(ibuf->mipmap[a]) IMB_freeImBuf(ibuf->mipmap[a]); + ibuf->mipmap[a]= NULL; + } +} + +/* any free rect frees mipmaps to be sure, creation is in render on first request */ void imb_freerectfloatImBuf(struct ImBuf * ibuf) { if (ibuf==NULL) return; @@ -73,10 +84,13 @@ void imb_freerectfloatImBuf(struct ImBuf * ibuf) } } + imb_freemipmapImBuf(ibuf); + ibuf->rect_float= NULL; ibuf->mall &= ~IB_rectfloat; } +/* any free rect frees mipmaps to be sure, creation is in render on first request */ void imb_freerectImBuf(struct ImBuf * ibuf) { if (ibuf==NULL) return; @@ -87,6 +101,8 @@ void imb_freerectImBuf(struct ImBuf * ibuf) } } + imb_freemipmapImBuf(ibuf); + ibuf->rect= NULL; ibuf->mall &= ~IB_rect; } @@ -363,7 +379,8 @@ struct ImBuf *IMB_allocImBuf(short x, short y, uchar d, unsigned int flags, ucha ibuf->y= y; ibuf->depth= d; ibuf->ftype= TGA; - + ibuf->channels= 4; /* float option, is set to other values when buffers get assigned */ + if (flags & IB_rect){ if (imb_addrectImBuf(ibuf)==FALSE){ IMB_freeImBuf(ibuf); @@ -407,7 +424,7 @@ struct ImBuf *IMB_dupImBuf(struct ImBuf *ibuf1) { struct ImBuf *ibuf2, tbuf; int flags = 0; - int x, y; + int a, x, y; if (ibuf1 == NULL) return NULL; @@ -452,6 +469,8 @@ struct ImBuf *IMB_dupImBuf(struct ImBuf *ibuf1) tbuf.encodedbuffer = ibuf2->encodedbuffer; tbuf.zbuf= NULL; tbuf.zbuf_float= NULL; + for(a=0; a<IB_MIPMAP_LEVELS; a++) + tbuf.mipmap[a]= NULL; // set malloc flag tbuf.mall = ibuf2->mall; |