From 4e4697b1c481094949165fa9edbe6aeebcfcf3b4 Mon Sep 17 00:00:00 2001 From: Ibrahn Sahir Date: Fri, 5 Jul 2019 18:08:43 +0100 Subject: Added release function to PoolVector::Access. For clarity, assign-to-release idiom for PoolVector::Read/Write replaced with a function call. Existing uses replaced (or removed if already handled by scope) --- modules/webp/image_loader_webp.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'modules/webp') diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 928a0dcbd3..630c15f140 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -71,7 +71,7 @@ static PoolVector _webp_lossy_pack(const Ref &p_image, float p_q w[3] = 'P'; copymem(&w[4], dst_buff, dst_size); free(dst_buff); - w = PoolVector::Write(); + w.release(); return dst; } @@ -110,7 +110,7 @@ static Ref _webp_lossy_unpack(const PoolVector &p_buffer) { //ERR_EXPLAIN("Error decoding webp! - "+p_file); ERR_FAIL_COND_V(errdec, Ref()); - dst_w = PoolVector::Write(); + dst_w.release(); Ref img = memnew(Image(features.width, features.height, 0, features.has_alpha ? Image::FORMAT_RGBA8 : Image::FORMAT_RGB8, dst_image)); return img; @@ -137,7 +137,7 @@ Error webp_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p } else { errdec = WebPDecodeRGBInto(p_buffer, p_buffer_len, dst_w.ptr(), datasize, 3 * features.width) == NULL; } - dst_w = PoolVector::Write(); + dst_w.release(); //ERR_EXPLAIN("Error decoding webp!"); ERR_FAIL_COND_V(errdec, ERR_FILE_CORRUPT); @@ -171,8 +171,6 @@ Error ImageLoaderWEBP::load_image(Ref p_image, FileAccess *f, bool p_forc Error err = webp_load_image_from_buffer(p_image.ptr(), w.ptr(), src_image_len); - w = PoolVector::Write(); - return err; } -- cgit v1.2.3