diff options
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r-- | source/blender/imbuf/intern/bmp.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/dpxlib.c | 3 | ||||
-rw-r--r-- | source/blender/imbuf/intern/cineon/logImageCore.c | 11 | ||||
-rw-r--r-- | source/blender/imbuf/intern/iris.c | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/openexr/openexr_api.cpp | 2 | ||||
-rw-r--r-- | source/blender/imbuf/intern/targa.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/tiff.c | 2 |
7 files changed, 12 insertions, 14 deletions
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index ab818d451d6..f897b1c6df3 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -301,7 +301,7 @@ int imb_savebmp(ImBuf *ibuf, const char *filepath, int UNUSED(flags)) BMPINFOHEADER infoheader; const size_t bytes_per_pixel = (ibuf->planes + 7) >> 3; - BLI_assert(bytes_per_pixel == 1 || bytes_per_pixel == 3); + BLI_assert(ELEM(bytes_per_pixel, 1, 3)); const size_t pad_bytes_per_scanline = (4 - ibuf->x * bytes_per_pixel % 4) % 4; const size_t bytesize = (ibuf->x * bytes_per_pixel + pad_bytes_per_scanline) * ibuf->y; diff --git a/source/blender/imbuf/intern/cineon/dpxlib.c b/source/blender/imbuf/intern/cineon/dpxlib.c index 73003265d8d..65482430346 100644 --- a/source/blender/imbuf/intern/cineon/dpxlib.c +++ b/source/blender/imbuf/intern/cineon/dpxlib.c @@ -348,8 +348,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf if (dpx->element[i].refHighQuantity == DPX_UNDEFINED_R32 || isnan(dpx->element[i].refHighQuantity)) { - if (dpx->element[i].transfer == transfer_PrintingDensity || - dpx->element[i].transfer == transfer_Logarithmic) { + if (ELEM(dpx->element[i].transfer, transfer_PrintingDensity, transfer_Logarithmic)) { dpx->element[i].refHighQuantity = 2.048f; } else { diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c index 446f360a3e7..d5f5691c5f0 100644 --- a/source/blender/imbuf/intern/cineon/logImageCore.c +++ b/source/blender/imbuf/intern/cineon/logImageCore.c @@ -215,7 +215,7 @@ size_t getRowLength(size_t width, LogImageElement logElement) if (logElement.packing == 0) { return ((width * logElement.depth * 10 - 1) / 32 + 1) * 4; } - else if (logElement.packing == 1 || logElement.packing == 2) { + else if (ELEM(logElement.packing, 1, 2)) { return ((width * logElement.depth - 1) / 3 + 1) * 4; } break; @@ -223,7 +223,7 @@ size_t getRowLength(size_t width, LogImageElement logElement) if (logElement.packing == 0) { return ((width * logElement.depth * 12 - 1) / 32 + 1) * 4; } - else if (logElement.packing == 1 || logElement.packing == 2) { + else if (ELEM(logElement.packing, 1, 2)) { return width * logElement.depth * 2; } break; @@ -442,8 +442,7 @@ int logImageGetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB for (i = 0; i < logImage->numElements; i++) { /* descriptor_Depth and descriptor_Composite are not supported */ - if (logImage->element[i].descriptor != descriptor_Depth && - logImage->element[i].descriptor != descriptor_Composite) { + if (!ELEM(logImage->element[i].descriptor, descriptor_Depth, descriptor_Composite)) { /* Allocate memory */ elementData[i] = imb_alloc_pixels( logImage->width, logImage->height, logImage->element[i].depth, sizeof(float), __func__); @@ -680,7 +679,7 @@ static int logImageElementGetData(LogImageFile *logImage, LogImageElement logEle if (logElement.packing == 0) { return logImageElementGetData10Packed(logImage, logElement, data); } - else if (logElement.packing == 1 || logElement.packing == 2) { + else if (ELEM(logElement.packing, 1, 2)) { return logImageElementGetData10(logImage, logElement, data); } break; @@ -689,7 +688,7 @@ static int logImageElementGetData(LogImageFile *logImage, LogImageElement logEle if (logElement.packing == 0) { return logImageElementGetData12Packed(logImage, logElement, data); } - else if (logElement.packing == 1 || logElement.packing == 2) { + else if (ELEM(logElement.packing, 1, 2)) { return logImageElementGetData12(logImage, logElement, data); } break; diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index 12c4c63849c..214cdf1b63b 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -286,7 +286,7 @@ struct ImBuf *imb_loadiris(const uchar *mem, size_t size, int flags, char colors rle = ISRLE(image.type); bpp = BPP(image.type); - if (bpp != 1 && bpp != 2) { + if (!ELEM(bpp, 1, 2)) { fprintf(stderr, "longimagedata: image must have 1 or 2 byte per pix chan\n"); return NULL; } diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index ca70ec633c1..7bb4176f4a6 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1610,7 +1610,7 @@ static ExrHandle *imb_exr_begin_read_mem(IStream &file_stream, memset(lookup, 0, sizeof(lookup)); /* we can have RGB(A), XYZ(W), UVA */ - if (pass->totchan == 3 || pass->totchan == 4) { + if (ELEM(pass->totchan, 3, 4)) { if (pass->chan[0]->chan_id == 'B' || pass->chan[1]->chan_id == 'B' || pass->chan[2]->chan_id == 'B') { lookup[(unsigned int)'R'] = 0; diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index 5f373e4bd3a..5a3cbd375b6 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -703,7 +703,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem, return ibuf; } - if (tga.imgtyp != 1 && tga.imgtyp != 9) { /* happens sometimes (beuh) */ + if (!ELEM(tga.imgtyp, 1, 9)) { /* happens sometimes (beuh) */ if (cmap) { MEM_freeN(cmap); cmap = NULL; @@ -777,7 +777,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem, ibuf->planes = 24; } - if (tga.imgtyp == 3 || tga.imgtyp == 11) { + if (ELEM(tga.imgtyp, 3, 11)) { uchar *crect; unsigned int *lrect, col; diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index cd0b012d809..bc69a14fa47 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -888,7 +888,7 @@ int imb_savetiff(ImBuf *ibuf, const char *filepath, int flags) /* convert from float source */ float rgb[4]; - if (channels_in_float == 3 || channels_in_float == 4) { + if (ELEM(channels_in_float, 3, 4)) { if (ibuf->float_colorspace || (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA)) { /* Float buffer was managed already, no need in color * space conversion. |