From 3205a92ad872f918c8322cdcd1434c231a1fd251 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 17 Feb 2020 18:06:54 -0300 Subject: PoolVector is gone, replaced by Vector Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector`. --- modules/pvr/texture_loader_pvr.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'modules/pvr') diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 36f2fe1ba1..dab4f64393 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -96,12 +96,12 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path, print_line("surfcount: "+itos(surfcount)); */ - PoolVector data; + Vector data; data.resize(surfsize); ERR_FAIL_COND_V(data.size() == 0, RES()); - PoolVector::Write w = data.write(); + uint8_t *w = data.ptrw(); f->get_buffer(&w[0], surfsize); err = f->get_error(); ERR_FAIL_COND_V(err != OK, RES()); @@ -152,8 +152,6 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path, ERR_FAIL_V_MSG(RES(), "Unsupported format in PVR texture: " + itos(flags & 0xFF) + "."); } - w.release(); - Ref image = memnew(Image(width, height, mipmaps, format, data)); ERR_FAIL_COND_V(image->empty(), RES()); @@ -200,10 +198,10 @@ static void _compress_pvrtc4(Image *p_img) { new_img.instance(); new_img->create(img->get_width(), img->get_height(), img->has_mipmaps(), use_alpha ? Image::FORMAT_PVRTC4A : Image::FORMAT_PVRTC4); - PoolVector data = new_img->get_data(); + Vector data = new_img->get_data(); { - PoolVector::Write wr = data.write(); - PoolVector::Read r = img->get_data().read(); + uint8_t *wr = data.ptrw(); + const uint8_t *r = img->get_data().ptr(); for (int i = 0; i <= new_img->get_mipmap_count(); i++) { @@ -640,17 +638,14 @@ static void _pvrtc_decompress(Image *p_img) { bool _2bit = (p_img->get_format() == Image::FORMAT_PVRTC2 || p_img->get_format() == Image::FORMAT_PVRTC2A); - PoolVector data = p_img->get_data(); - PoolVector::Read r = data.read(); + Vector data = p_img->get_data(); + const uint8_t *r = data.ptr(); - PoolVector newdata; + Vector newdata; newdata.resize(p_img->get_width() * p_img->get_height() * 4); - PoolVector::Write w = newdata.write(); - - decompress_pvrtc((PVRTCBlock *)r.ptr(), _2bit, p_img->get_width(), p_img->get_height(), 0, (unsigned char *)w.ptr()); + uint8_t *w = newdata.ptrw(); - w.release(); - r.release(); + decompress_pvrtc((PVRTCBlock *)r, _2bit, p_img->get_width(), p_img->get_height(), 0, (unsigned char *)w); bool make_mipmaps = p_img->has_mipmaps(); p_img->create(p_img->get_width(), p_img->get_height(), false, Image::FORMAT_RGBA8, newdata); -- cgit v1.2.3