diff options
Diffstat (limited to 'modules/tinyexr/image_loader_tinyexr.cpp')
-rw-r--r-- | modules/tinyexr/image_loader_tinyexr.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp index 1c0f3cd03e..9e7266b95a 100644 --- a/modules/tinyexr/image_loader_tinyexr.cpp +++ b/modules/tinyexr/image_loader_tinyexr.cpp @@ -36,7 +36,6 @@ #include "thirdparty/tinyexr/tinyexr.h" Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) { - Vector<uint8_t> src_image; int src_image_len = f->get_len(); ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT); @@ -62,7 +61,6 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f int ret = ParseEXRVersionFromMemory(&exr_version, w, src_image_len); if (ret != TINYEXR_SUCCESS) { - return ERR_FILE_CORRUPT; } @@ -141,12 +139,10 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f int output_channels = 0; if (idxA != -1) { - imgdata.resize(exr_image.width * exr_image.height * 8); //RGBA16 format = Image::FORMAT_RGBAH; output_channels = 4; } else { - imgdata.resize(exr_image.width * exr_image.height * 6); //RGB16 format = Image::FORMAT_RGBH; output_channels = 3; @@ -185,7 +181,6 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f // Assume `out_rgba` have enough memory allocated. for (int tile_index = 0; tile_index < num_tiles; tile_index++) { - const EXRTile &tile = exr_tiles[tile_index]; int tw = tile.width; @@ -215,11 +210,11 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f uint16_t *row_w = first_row_w + (y * exr_image.width * output_channels); for (int x = 0; x < tw; x++) { - Color color(*r_channel++, *g_channel++, *b_channel++); - if (p_force_linear) + if (p_force_linear) { color = color.to_linear(); + } *row_w++ = Math::make_half_float(color.r); *row_w++ = Math::make_half_float(color.g); @@ -242,7 +237,6 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f } void ImageLoaderTinyEXR::get_recognized_extensions(List<String> *p_extensions) const { - p_extensions->push_back("exr"); } |