summaryrefslogtreecommitdiff
path: root/modules/tinyexr/image_loader_tinyexr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/tinyexr/image_loader_tinyexr.cpp')
-rw-r--r--modules/tinyexr/image_loader_tinyexr.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp
index 688707a42d..6f61251f9b 100644
--- a/modules/tinyexr/image_loader_tinyexr.cpp
+++ b/modules/tinyexr/image_loader_tinyexr.cpp
@@ -37,7 +37,7 @@
#include "thirdparty/tinyexr/tinyexr.h"
-Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) {
+Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, Ref<FileAccess> f, uint32_t p_flags, float p_scale) {
Vector<uint8_t> src_image;
uint64_t src_image_len = f->get_length();
ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT);
@@ -47,8 +47,6 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
f->get_buffer(&w[0], src_image_len);
- f->close();
-
// Re-implementation of tinyexr's LoadEXRFromMemory using Godot types to store the Image data
// and Godot's error codes.
// When debugging after updating the thirdparty library, check that we're still in sync with
@@ -231,8 +229,8 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
color.a = *a_channel++;
}
- if (p_force_linear) {
- color = color.to_linear();
+ if (p_flags & FLAG_FORCE_LINEAR) {
+ color = color.srgb_to_linear();
}
*row_w++ = Math::make_half_float(color.r);
@@ -262,8 +260,8 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f
color.a = *a_channel++;
}
- if (p_force_linear) {
- color = color.to_linear();
+ if (p_flags & FLAG_FORCE_LINEAR) {
+ color = color.srgb_to_linear();
}
*row_w++ = color.r;