Fix loading EXR with alpha channel

Fixes #24659.

(cherry picked from commit 08f71baca5)
This commit is contained in:
Rémi Verschelde 2018-12-30 14:35:15 +01:00
parent cf2ebf5d47
commit c6cc6c86e5
1 changed files with 3 additions and 3 deletions

View File

@ -131,7 +131,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
Image::Format format; Image::Format format;
int output_channels = 0; int output_channels = 0;
if (idxA > 0) { if (idxA != -1) {
imgdata.resize(exr_image.width * exr_image.height * 8); //RGBA16 imgdata.resize(exr_image.width * exr_image.height * 8); //RGBA16
format = Image::FORMAT_RGBAH; format = Image::FORMAT_RGBAH;
@ -187,7 +187,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
const float *b_channel_start = reinterpret_cast<const float *>(tile.images[idxB]); const float *b_channel_start = reinterpret_cast<const float *>(tile.images[idxB]);
const float *a_channel_start = NULL; const float *a_channel_start = NULL;
if (idxA > 0) { if (idxA != -1) {
a_channel_start = reinterpret_cast<const float *>(tile.images[idxA]); a_channel_start = reinterpret_cast<const float *>(tile.images[idxA]);
} }
@ -216,7 +216,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
*row_w++ = Math::make_half_float(color.g); *row_w++ = Math::make_half_float(color.g);
*row_w++ = Math::make_half_float(color.b); *row_w++ = Math::make_half_float(color.b);
if (idxA > 0) { if (idxA != -1) {
*row_w++ = Math::make_half_float(*a_channel++); *row_w++ = Math::make_half_float(*a_channel++);
} }
} }