diff options
Diffstat (limited to 'source/blender/imbuf/intern/targa.c')
-rw-r--r-- | source/blender/imbuf/intern/targa.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index 2dcb27a05d4..7073d34e2bc 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -44,7 +44,6 @@ #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" -#include "IMB_allocimbuf.h" #include "IMB_filetype.h" #include "IMB_colormanagement.h" @@ -265,7 +264,7 @@ int imb_savetarga(struct ImBuf *ibuf, const char *name, int flags) buf[2] = 11; } - if (ibuf->ftype == RAWTGA) buf[2] &= ~8; + if (ibuf->foptions.flag & RAWTGA) buf[2] &= ~8; buf[8] = 0; buf[9] = 0; @@ -290,7 +289,7 @@ int imb_savetarga(struct ImBuf *ibuf, const char *name, int flags) return 0; } - if (ibuf->ftype == RAWTGA) { + if (ibuf->foptions.flag & RAWTGA) { ok = dumptarga(ibuf, fildes); } else { @@ -315,7 +314,7 @@ int imb_savetarga(struct ImBuf *ibuf, const char *name, int flags) } -static int checktarga(TARGA *tga, unsigned char *mem) +static int checktarga(TARGA *tga, const unsigned char *mem) { tga->numid = mem[0]; tga->maptyp = mem[1]; @@ -351,7 +350,7 @@ static int checktarga(TARGA *tga, unsigned char *mem) return 1; } -int imb_is_a_targa(unsigned char *buf) +int imb_is_a_targa(const unsigned char *buf) { TARGA tga; @@ -373,9 +372,9 @@ static void complete_partial_load(struct ImBuf *ibuf, unsigned int *rect) } } -static void decodetarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size, int psize) +static void decodetarga(struct ImBuf *ibuf, const unsigned char *mem, size_t mem_size, int psize) { - unsigned char *mem_end = mem + mem_size; + const unsigned char *mem_end = mem + mem_size; int count, col, size; unsigned int *rect; uchar *cp = (uchar *) &col; @@ -491,9 +490,9 @@ partial_load: complete_partial_load(ibuf, rect); } -static void ldtarga(struct ImBuf *ibuf, unsigned char *mem, size_t mem_size, int psize) +static void ldtarga(struct ImBuf *ibuf, const unsigned char *mem, size_t mem_size, int psize) { - unsigned char *mem_end = mem + mem_size; + const unsigned char *mem_end = mem + mem_size; int col, size; unsigned int *rect; uchar *cp = (uchar *) &col; @@ -551,7 +550,7 @@ partial_load: } -ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags, char colorspace[IM_MAX_SPACE]) +ImBuf *imb_loadtarga(const unsigned char *mem, size_t mem_size, int flags, char colorspace[IM_MAX_SPACE]) { TARGA tga; struct ImBuf *ibuf; @@ -569,7 +568,9 @@ ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags, char colors else ibuf = IMB_allocImBuf(tga.xsize, tga.ysize, (tga.pixsize + 0x7) & ~0x7, IB_rect); if (ibuf == NULL) return NULL; - ibuf->ftype = TGA; + ibuf->ftype = IMB_FTYPE_TGA; + if (tga.imgtyp < 4) + ibuf->foptions.flag |= RAWTGA; mem = mem + 18 + tga.numid; cp[0] = 0xff; |