From c6cc6c86e504c6f8b907ca51d1ab32310a250206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 30 Dec 2018 14:35:15 +0100 Subject: [PATCH] Fix loading EXR with alpha channel Fixes #24659. (cherry picked from commit 08f71baca51a927dd20e4e10dd67e41cdeadd40d) --- modules/tinyexr/image_loader_tinyexr.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp index f079730e84f..c5e5c132285 100644 --- a/modules/tinyexr/image_loader_tinyexr.cpp +++ b/modules/tinyexr/image_loader_tinyexr.cpp @@ -131,7 +131,7 @@ Error ImageLoaderTinyEXR::load_image(Ref p_image, FileAccess *f, bool p_f Image::Format format; int output_channels = 0; - if (idxA > 0) { + if (idxA != -1) { imgdata.resize(exr_image.width * exr_image.height * 8); //RGBA16 format = Image::FORMAT_RGBAH; @@ -187,7 +187,7 @@ Error ImageLoaderTinyEXR::load_image(Ref p_image, FileAccess *f, bool p_f const float *b_channel_start = reinterpret_cast(tile.images[idxB]); const float *a_channel_start = NULL; - if (idxA > 0) { + if (idxA != -1) { a_channel_start = reinterpret_cast(tile.images[idxA]); } @@ -216,7 +216,7 @@ Error ImageLoaderTinyEXR::load_image(Ref p_image, FileAccess *f, bool p_f *row_w++ = Math::make_half_float(color.g); *row_w++ = Math::make_half_float(color.b); - if (idxA > 0) { + if (idxA != -1) { *row_w++ = Math::make_half_float(*a_channel++); } }