diff options
Diffstat (limited to 'modules/tinyexr/image_loader_tinyexr.cpp')
-rw-r--r-- | modules/tinyexr/image_loader_tinyexr.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp index 79cb135abb..41938f5b42 100644 --- a/modules/tinyexr/image_loader_tinyexr.cpp +++ b/modules/tinyexr/image_loader_tinyexr.cpp @@ -37,12 +37,12 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) { - PoolVector<uint8_t> src_image; + Vector<uint8_t> src_image; int src_image_len = f->get_len(); ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT); src_image.resize(src_image_len); - PoolVector<uint8_t>::Write w = src_image.write(); + uint8_t *w = src_image.ptrw(); f->get_buffer(&w[0], src_image_len); @@ -60,13 +60,13 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f InitEXRHeader(&exr_header); - int ret = ParseEXRVersionFromMemory(&exr_version, w.ptr(), src_image_len); + int ret = ParseEXRVersionFromMemory(&exr_version, w, src_image_len); if (ret != TINYEXR_SUCCESS) { return ERR_FILE_CORRUPT; } - ret = ParseEXRHeaderFromMemory(&exr_header, &exr_version, w.ptr(), src_image_len, &err); + ret = ParseEXRHeaderFromMemory(&exr_header, &exr_version, w, src_image_len, &err); if (ret != TINYEXR_SUCCESS) { if (err) { ERR_PRINT(String(err)); @@ -82,7 +82,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f } InitEXRImage(&exr_image); - ret = LoadEXRImageFromMemory(&exr_image, &exr_header, w.ptr(), src_image_len, &err); + ret = LoadEXRImageFromMemory(&exr_image, &exr_header, w, src_image_len, &err); if (ret != TINYEXR_SUCCESS) { if (err) { ERR_PRINT(String(err)); @@ -136,7 +136,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f // EXR image data loaded, now parse it into Godot-friendly image data - PoolVector<uint8_t> imgdata; + Vector<uint8_t> imgdata; Image::Format format; int output_channels = 0; @@ -180,8 +180,8 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f } { - PoolVector<uint8_t>::Write wd = imgdata.write(); - uint16_t *iw = (uint16_t *)wd.ptr(); + uint8_t *wd = imgdata.ptrw(); + uint16_t *iw = (uint16_t *)wd; // Assume `out_rgba` have enough memory allocated. for (int tile_index = 0; tile_index < num_tiles; tile_index++) { @@ -235,8 +235,6 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, FileAccess *f, bool p_f p_image->create(exr_image.width, exr_image.height, false, format, imgdata); - w.release(); - FreeEXRHeader(&exr_header); FreeEXRImage(&exr_image); |