Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/allocimbuf.c
| Show First 20 Lines • Show All 470 Lines • ▼ Show 20 Lines | if ((ibuf->tiles = MEM_callocN(sizeof(unsigned int *) * ibuf->xtiles * ibuf->ytiles, | ||||
| "imb_tiles"))) { | "imb_tiles"))) { | ||||
| ibuf->mall |= IB_tiles; | ibuf->mall |= IB_tiles; | ||||
| } | } | ||||
| } | } | ||||
| return (ibuf->tiles != NULL); | return (ibuf->tiles != NULL); | ||||
| } | } | ||||
| ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int flags) | ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, eImBufFlags flags) | ||||
| { | { | ||||
| ImBuf *ibuf; | ImBuf *ibuf; | ||||
| ibuf = MEM_mallocN(sizeof(ImBuf), "ImBuf_struct"); | ibuf = MEM_mallocN(sizeof(ImBuf), "ImBuf_struct"); | ||||
| if (ibuf) { | if (ibuf) { | ||||
| if (!IMB_initImBuf(ibuf, x, y, planes, flags)) { | if (!IMB_initImBuf(ibuf, x, y, planes, flags)) { | ||||
| IMB_freeImBuf(ibuf); | IMB_freeImBuf(ibuf); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| } | } | ||||
| return (ibuf); | return (ibuf); | ||||
| } | } | ||||
| bool IMB_initImBuf( | bool IMB_initImBuf( | ||||
| struct ImBuf *ibuf, unsigned int x, unsigned int y, unsigned char planes, unsigned int flags) | struct ImBuf *ibuf, unsigned int x, unsigned int y, unsigned char planes, eImBufFlags flags) | ||||
| { | { | ||||
| memset(ibuf, 0, sizeof(ImBuf)); | memset(ibuf, 0, sizeof(ImBuf)); | ||||
| ibuf->x = x; | ibuf->x = x; | ||||
| ibuf->y = y; | ibuf->y = y; | ||||
| ibuf->planes = planes; | ibuf->planes = planes; | ||||
| ibuf->ftype = IMB_FTYPE_PNG; | ibuf->ftype = IMB_FTYPE_PNG; | ||||
| /* The '15' means, set compression to low ratio but not time consuming. */ | /* The '15' means, set compression to low ratio but not time consuming. */ | ||||
| Show All 32 Lines | bool IMB_initImBuf( | ||||
| return true; | return true; | ||||
| } | } | ||||
| /* does no zbuffers? */ | /* does no zbuffers? */ | ||||
| ImBuf *IMB_dupImBuf(const ImBuf *ibuf1) | ImBuf *IMB_dupImBuf(const ImBuf *ibuf1) | ||||
| { | { | ||||
| ImBuf *ibuf2, tbuf; | ImBuf *ibuf2, tbuf; | ||||
| int flags = 0; | eImBufFlags flags = 0; | ||||
| int a, x, y; | int a, x, y; | ||||
| if (ibuf1 == NULL) { | if (ibuf1 == NULL) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| if (ibuf1->rect) { | if (ibuf1->rect) { | ||||
| flags |= IB_rect; | flags |= IB_rect; | ||||
| ▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines | |||||