diff options
41 files changed, 102 insertions, 114 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 1bf3425d50..34bbdb2c75 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1932,13 +1932,15 @@ PoolVector<uint8_t> _File::get_buffer(int p_length) const { ERR_FAIL_COND_V(p_length < 0, data); if (p_length == 0) return data; + Error err = data.resize(p_length); ERR_FAIL_COND_V(err != OK, data); + PoolVector<uint8_t>::Write w = data.write(); int len = f->get_buffer(&w[0], p_length); ERR_FAIL_COND_V(len < 0, PoolVector<uint8_t>()); - w = PoolVector<uint8_t>::Write(); + w.release(); if (len < p_length) data.resize(p_length); @@ -2113,11 +2115,11 @@ void _File::store_var(const Variant &p_var, bool p_full_objects) { PoolVector<uint8_t> buff; buff.resize(len); - PoolVector<uint8_t>::Write w = buff.write(); + PoolVector<uint8_t>::Write w = buff.write(); err = encode_variant(p_var, &w[0], len, p_full_objects); ERR_FAIL_COND(err != OK); - w = PoolVector<uint8_t>::Write(); + w.release(); store_32(len); store_buffer(buff); diff --git a/core/image.cpp b/core/image.cpp index 18a3aae88f..a88395204a 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -495,8 +495,8 @@ void Image::convert(Format p_new_format) { case FORMAT_RGBA8 | (FORMAT_RGB8 << 8): _convert<3, true, 3, false, false, false>(width, height, rptr, wptr); break; } - r = PoolVector<uint8_t>::Read(); - w = PoolVector<uint8_t>::Write(); + r.release(); + w.release(); bool gen_mipmaps = mipmaps; @@ -1091,8 +1091,8 @@ void Image::resize(int p_width, int p_height, Interpolation p_interpolation) { } break; } - r = PoolVector<uint8_t>::Read(); - w = PoolVector<uint8_t>::Write(); + r.release(); + w.release(); if (interpolate_mipmaps) { dst._copy_internals_from(dst2); @@ -2394,7 +2394,7 @@ void Image::lock() { void Image::unlock() { - write_lock = PoolVector<uint8_t>::Write(); + write_lock.release(); } Color Image::get_pixelv(const Point2 &p_src) const { diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 17a3f52a65..dc5581ea01 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -558,8 +558,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int w[i] = buf[i]; } - - w = PoolVector<uint8_t>::Write(); } r_variant = data; @@ -590,8 +588,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int w[i] = decode_uint32(&buf[i * 4]); } - - w = PoolVector<int>::Write(); } r_variant = Variant(data); if (r_len) { @@ -618,8 +614,6 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int w[i] = decode_float(&buf[i * 4]); } - - w = PoolVector<float>::Write(); } r_variant = data; diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 688dfc21e5..861e34e415 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -410,7 +410,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { PoolVector<uint8_t>::Write w = array.write(); f->get_buffer(w.ptr(), len); _advance_padding(len); - w = PoolVector<uint8_t>::Write(); + w.release(); r_v = array; } break; @@ -432,7 +432,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { } #endif - w = PoolVector<int>::Write(); + w.release(); r_v = array; } break; case VARIANT_REAL_ARRAY: { @@ -454,7 +454,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { #endif - w = PoolVector<real_t>::Write(); + w.release(); r_v = array; } break; case VARIANT_STRING_ARRAY: { @@ -465,7 +465,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { PoolVector<String>::Write w = array.write(); for (uint32_t i = 0; i < len; i++) w[i] = get_unicode_string(); - w = PoolVector<String>::Write(); + w.release(); r_v = array; } break; @@ -493,7 +493,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { ERR_EXPLAIN("Vector2 size is NOT 8!"); ERR_FAIL_V(ERR_UNAVAILABLE); } - w = PoolVector<Vector2>::Write(); + w.release(); r_v = array; } break; @@ -521,7 +521,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { ERR_EXPLAIN("Vector3 size is NOT 12!"); ERR_FAIL_V(ERR_UNAVAILABLE); } - w = PoolVector<Vector3>::Write(); + w.release(); r_v = array; } break; @@ -549,7 +549,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { ERR_EXPLAIN("Color size is NOT 16!"); ERR_FAIL_V(ERR_UNAVAILABLE); } - w = PoolVector<Color>::Write(); + w.release(); r_v = array; } break; #ifndef DISABLE_DEPRECATED @@ -584,7 +584,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { PoolVector<uint8_t>::Write w = imgdata.write(); f->get_buffer(w.ptr(), datalen); _advance_padding(datalen); - w = PoolVector<uint8_t>::Write(); + w.release(); Ref<Image> image; image.instance(); @@ -597,7 +597,7 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { data.resize(f->get_32()); PoolVector<uint8_t>::Write w = data.write(); f->get_buffer(w.ptr(), data.size()); - w = PoolVector<uint8_t>::Write(); + w.release(); Ref<Image> image; diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index 6ad24a5f3a..acf72dbba5 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -79,7 +79,7 @@ Array StreamPeer::_get_data(int p_bytes) { PoolVector<uint8_t>::Write w = data.write(); Error err = get_data(&w[0], p_bytes); - w = PoolVector<uint8_t>::Write(); + w.release(); ret.push_back(err); ret.push_back(data); return ret; @@ -101,7 +101,7 @@ Array StreamPeer::_get_partial_data(int p_bytes) { PoolVector<uint8_t>::Write w = data.write(); int received; Error err = get_partial_data(&w[0], p_bytes, received); - w = PoolVector<uint8_t>::Write(); + w.release(); if (err != OK) { data.resize(0); diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index 83784a1fa7..546981be44 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -182,7 +182,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) { int max_alloc = fc; _create_bvh(bw.ptr(), bwp.ptr(), 0, fc, 1, max_depth, max_alloc); - bw = PoolVector<BVH>::Write(); //clearup + bw.release(); //clearup bvh.resize(max_alloc); //resize back valid = true; @@ -751,7 +751,7 @@ PoolVector<Face3> TriangleMesh::get_faces() const { } } - w = PoolVector<Face3>::Write(); + w.release(); return faces; } diff --git a/core/pool_vector.h b/core/pool_vector.h index 338de966f6..aba66e3909 100644 --- a/core/pool_vector.h +++ b/core/pool_vector.h @@ -301,6 +301,10 @@ public: virtual ~Access() { _unref(); } + + void release() { + _unref(); + } }; class Read : public Access { diff --git a/core/variant.cpp b/core/variant.cpp index 5b51a4e513..fe9623d068 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -2418,9 +2418,6 @@ Variant::Variant(const PoolVector<Face3> &p_face_array) { for (int j = 0; j < 3; j++) w[i * 3 + j] = r[i].vertex[j]; } - - r = PoolVector<Face3>::Read(); - w = PoolVector<Vector3>::Write(); } type = NIL; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 4c3cbfa484..3fdd18a630 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -319,7 +319,7 @@ struct _VariantCall { retval.resize(len); PoolByteArray::Write w = retval.write(); copymem(w.ptr(), charstr.ptr(), len); - w = PoolVector<uint8_t>::Write(); + w.release(); r_ret = retval; } @@ -334,7 +334,7 @@ struct _VariantCall { retval.resize(len); PoolByteArray::Write w = retval.write(); copymem(w.ptr(), charstr.ptr(), len); - w = PoolVector<uint8_t>::Write(); + w.release(); r_ret = retval; } diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp index b08202ae45..c591db4f3d 100644 --- a/drivers/gles2/rasterizer_storage_gles2.cpp +++ b/drivers/gles2/rasterizer_storage_gles2.cpp @@ -807,7 +807,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer) } } - wb = PoolVector<uint8_t>::Write(); + wb.release(); data.resize(data_size); @@ -871,7 +871,7 @@ Ref<Image> RasterizerStorageGLES2::texture_get_data(RID p_texture, int p_layer) glBindFramebuffer(GL_FRAMEBUFFER, 0); glDeleteFramebuffers(1, &temp_framebuffer); - wb = PoolVector<uint8_t>::Write(); + wb.release(); data.resize(data_size); @@ -2155,8 +2155,8 @@ static PoolVector<uint8_t> _unpack_half_floats(const PoolVector<uint8_t> &array, dst_offset += dst_size[i]; } - r = PoolVector<uint8_t>::Read(); - w = PoolVector<uint8_t>::Write(); + r.release(); + w.release(); return ret; } diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index c2fde148e2..fb3d154a7a 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1459,8 +1459,8 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e, const Transfo #else PoolVector<RasterizerGLES3Particle> particle_vector; particle_vector.resize(particles->amount); - PoolVector<RasterizerGLES3Particle>::Write w = particle_vector.write(); - particle_array = w.ptr(); + PoolVector<RasterizerGLES3Particle>::Write particle_writer = particle_vector.write(); + particle_array = particle_writer.ptr(); glGetBufferSubData(GL_ARRAY_BUFFER, 0, particles->amount * sizeof(RasterizerGLES3Particle), particle_array); #endif @@ -1477,7 +1477,7 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e, const Transfo #ifndef __EMSCRIPTEN__ glUnmapBuffer(GL_ARRAY_BUFFER); #else - w = PoolVector<RasterizerGLES3Particle>::Write(); + particle_writer.release(); particle_array = NULL; { PoolVector<RasterizerGLES3Particle>::Read r = particle_vector.read(); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index b280898188..7efe6a987a 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -1173,7 +1173,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer) glDeleteFramebuffers(1, &tmp_fbo); } - wb = PoolVector<uint8_t>::Write(); + wb.release(); data.resize(data_size); @@ -1248,7 +1248,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer) img_format = real_format; } - wb = PoolVector<uint8_t>::Write(); + wb.release(); data.resize(data_size); @@ -1316,7 +1316,7 @@ Ref<Image> RasterizerStorageGLES3::texture_get_data(RID p_texture, int p_layer) glBindFramebuffer(GL_FRAMEBUFFER, 0); glDeleteFramebuffers(1, &temp_framebuffer); - wb = PoolVector<uint8_t>::Write(); + wb.release(); data.resize(data_size); @@ -6337,7 +6337,7 @@ AABB RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) { } #if defined(GLES_OVER_GL) || defined(__EMSCRIPTEN__) - r = PoolVector<uint8_t>::Read(); + r.release(); vector = PoolVector<uint8_t>(); #else glUnmapBuffer(GL_ARRAY_BUFFER); diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 9cf36f162d..471742948f 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -340,7 +340,7 @@ void EditorProfiler::_update_plot() { } } - wr = PoolVector<uint8_t>::Write(); + wr.release(); Ref<Image> img; img.instance(); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 285823d95a..d260b171a8 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -676,7 +676,7 @@ Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const S } } - imgdata = PoolVector<uint8_t>::Write(); + imgdata.release(); //post_process_preview(img); Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture)); diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index cae705a697..d59efe49e7 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -144,7 +144,7 @@ void MultiMeshEditor::_populate() { } } - w = PoolVector<Face3>::Write(); + w.release(); PoolVector<Face3> faces = geometry; ERR_EXPLAIN(TTR("Parent has no solid faces to populate.")); diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index f05e7d65d3..75d31459e8 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -197,7 +197,7 @@ void ParticlesEditorBase::_node_selected(const NodePath &p_path) { } } - w = PoolVector<Face3>::Write(); + w.release(); emission_dialog->popup_centered(Size2(300, 130)); } diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 35cfdf15be..2b59787f17 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -1491,7 +1491,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { w[i] = current_shape[i] - shape_anchor; } - w = PoolVector<Vector2>::Write(); + w.release(); undo_redo->create_action(TTR("Edit Occlusion Polygon")); undo_redo->add_do_method(edited_occlusion_shape.ptr(), "set_polygon", polygon); @@ -1514,7 +1514,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { indices.push_back(i); } - w = PoolVector<Vector2>::Write(); + w.release(); undo_redo->create_action(TTR("Edit Navigation Polygon")); undo_redo->add_do_method(edited_navigation_shape.ptr(), "set_vertices", polygon); @@ -2785,7 +2785,7 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) { w[i] = current_shape[i] - shape_anchor; } - w = PoolVector<Vector2>::Write(); + w.release(); shape->set_polygon(polygon); undo_redo->create_action(TTR("Create Occlusion Polygon")); @@ -2813,7 +2813,7 @@ void TileSetEditor::close_shape(const Vector2 &shape_anchor) { indices.push_back(i); } - w = PoolVector<Vector2>::Write(); + w.release(); shape->set_vertices(polygon); shape->add_polygon(indices); diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 0a714dcc6c..23725c4960 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -436,10 +436,10 @@ void CSGShape::_update_shape() { } // unset write access - surfaces.write[i].verticesw = PoolVector<Vector3>::Write(); - surfaces.write[i].normalsw = PoolVector<Vector3>::Write(); - surfaces.write[i].uvsw = PoolVector<Vector2>::Write(); - surfaces.write[i].tansw = PoolVector<float>::Write(); + surfaces.write[i].verticesw.release(); + surfaces.write[i].normalsw.release(); + surfaces.write[i].uvsw.release(); + surfaces.write[i].tansw.release(); if (surfaces[i].last_added == 0) continue; diff --git a/modules/cvtt/image_compress_cvtt.cpp b/modules/cvtt/image_compress_cvtt.cpp index 024e9ffc3b..17b0038780 100644 --- a/modules/cvtt/image_compress_cvtt.cpp +++ b/modules/cvtt/image_compress_cvtt.cpp @@ -388,8 +388,8 @@ void image_decompress_cvtt(Image *p_image) { h >>= 1; } - rb = PoolVector<uint8_t>::Read(); - wb = PoolVector<uint8_t>::Write(); + rb.release(); + wb.release(); p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data); } diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index 197b41b30c..4628bd9a5b 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -251,7 +251,6 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, src_data.resize(size); PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(), size); - wb = PoolVector<uint8_t>::Write(); } else if (info.palette) { @@ -296,8 +295,6 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, if (colsize == 4) wb[dst_ofs + 3] = palette[src_ofs + 3]; } - - wb = PoolVector<uint8_t>::Write(); } else { //uncompressed generic... @@ -444,8 +441,6 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path, default: { } } - - wb = PoolVector<uint8_t>::Write(); } Ref<Image> img = memnew(Image(width, height, mipmaps - 1, info.format, src_data)); diff --git a/modules/etc/texture_loader_pkm.cpp b/modules/etc/texture_loader_pkm.cpp index f302834222..ff925480b8 100644 --- a/modules/etc/texture_loader_pkm.cpp +++ b/modules/etc/texture_loader_pkm.cpp @@ -80,7 +80,7 @@ RES ResourceFormatPKM::load(const String &p_path, const String &p_original_path, src_data.resize(size); PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(), size); - wb = PoolVector<uint8_t>::Write(); + wb.release(); int mipmaps = h.format; int width = h.origWidth; diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp index 5493223cb0..dcd8b8aebd 100644 --- a/modules/jpg/image_loader_jpegd.cpp +++ b/modules/jpg/image_loader_jpegd.cpp @@ -96,7 +96,7 @@ Error jpeg_load_image_from_buffer(Image *p_image, const uint8_t *p_buffer, int p else fmt = Image::FORMAT_RGB8; - dw = PoolVector<uint8_t>::Write(); + dw.release(); p_image->create(image_width, image_height, 0, fmt, data); return OK; @@ -117,8 +117,6 @@ Error ImageLoaderJPG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force Error err = jpeg_load_image_from_buffer(p_image.ptr(), w.ptr(), src_image_len); - w = PoolVector<uint8_t>::Write(); - return err; } diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 8f6ffcc83f..8b1f21d95d 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -153,7 +153,7 @@ RES ResourceFormatPVR::load(const String &p_path, const String &p_original_path, ERR_FAIL_V(RES()); } - w = PoolVector<uint8_t>::Write(); + w.release(); int tex_flags = Texture::FLAG_FILTER | Texture::FLAG_REPEAT; @@ -655,8 +655,8 @@ static void _pvrtc_decompress(Image *p_img) { decompress_pvrtc((PVRTCBlock *)r.ptr(), _2bit, p_img->get_width(), p_img->get_height(), 0, (unsigned char *)w.ptr()); - w = PoolVector<uint8_t>::Write(); - r = PoolVector<uint8_t>::Read(); + w.release(); + r.release(); bool make_mipmaps = p_img->has_mipmaps(); p_img->create(p_img->get_width(), p_img->get_height(), false, Image::FORMAT_RGBA8, newdata); diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index 4f38357aa1..64f4c169cb 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -198,8 +198,8 @@ void image_compress_squish(Image *p_image, float p_lossy_quality, Image::Compres h = MAX(h / 2, 1); } - rb = PoolVector<uint8_t>::Read(); - wb = PoolVector<uint8_t>::Write(); + rb.release(); + wb.release(); p_image->create(p_image->get_width(), p_image->get_height(), p_image->has_mipmaps(), target_format, data); } diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index b5f4718c72..0922471500 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -188,7 +188,7 @@ void AudioStreamOGGVorbis::set_data(const PoolVector<uint8_t> &p_data) { ogg_stream = stb_vorbis_open_memory((const unsigned char *)src_datar.ptr(), src_data_len, &error, &ogg_alloc); if (!ogg_stream && error == VORBIS_outofmem) { - w = PoolVector<char>::Write(); + w.release(); alloc_try *= 2; } else { diff --git a/modules/svg/image_loader_svg.cpp b/modules/svg/image_loader_svg.cpp index e36844a1bc..b0cd648734 100644 --- a/modules/svg/image_loader_svg.cpp +++ b/modules/svg/image_loader_svg.cpp @@ -123,7 +123,7 @@ Error ImageLoaderSVG::_create_image(Ref<Image> p_image, const PoolVector<uint8_t rasterizer.rasterize(svg_image, 0, 0, p_scale * upscale, (unsigned char *)dw.ptr(), w, h, w * 4); - dw = PoolVector<uint8_t>::Write(); + dw.release(); p_image->create(w, h, false, Image::FORMAT_RGBA8, dst_image); if (upsample) p_image->shrink_x2(); diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp index a3c0f5ded7..6ee408d472 100644 --- a/modules/tga/image_loader_tga.cpp +++ b/modules/tga/image_loader_tga.cpp @@ -199,7 +199,7 @@ Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buff } } - image_data_w = PoolVector<uint8_t>::Write(); + image_data_w.release(); p_image->create(width, height, 0, Image::FORMAT_RGBA8, image_data); diff --git a/modules/tinyexr/image_loader_tinyexr.cpp b/modules/tinyexr/image_loader_tinyexr.cpp index a9340b1498..74a584821a 100644 --- a/modules/tinyexr/image_loader_tinyexr.cpp +++ b/modules/tinyexr/image_loader_tinyexr.cpp @@ -235,7 +235,7 @@ 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 = PoolVector<uint8_t>::Write(); + w.release(); FreeEXRHeader(&exr_header); FreeEXRImage(&exr_image); 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<uint8_t> _webp_lossy_pack(const Ref<Image> &p_image, float p_q w[3] = 'P'; copymem(&w[4], dst_buff, dst_size); free(dst_buff); - w = PoolVector<uint8_t>::Write(); + w.release(); return dst; } @@ -110,7 +110,7 @@ static Ref<Image> _webp_lossy_unpack(const PoolVector<uint8_t> &p_buffer) { //ERR_EXPLAIN("Error decoding webp! - "+p_file); ERR_FAIL_COND_V(errdec, Ref<Image>()); - dst_w = PoolVector<uint8_t>::Write(); + dst_w.release(); Ref<Image> 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<uint8_t>::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<Image> p_image, FileAccess *f, bool p_forc Error err = webp_load_image_from_buffer(p_image.ptr(), w.ptr(), src_image_len); - w = PoolVector<uint8_t>::Write(); - return err; } diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index 466f79c215..77f077456e 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -289,7 +289,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { PoolVector<int>::Write w = sarr.write(); env->GetIntArrayRegion(arr, 0, fCount, w.ptr()); - w = PoolVector<int>::Write(); + w.release(); return sarr; }; @@ -302,7 +302,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { PoolVector<uint8_t>::Write w = sarr.write(); env->GetByteArrayRegion(arr, 0, fCount, reinterpret_cast<signed char *>(w.ptr())); - w = PoolVector<uint8_t>::Write(); + w.release(); return sarr; }; @@ -514,7 +514,7 @@ public: PoolVector<int>::Write w = sarr.write(); env->GetIntArrayRegion(arr, 0, fCount, w.ptr()); - w = PoolVector<int>::Write(); + w.release(); ret = sarr; env->DeleteLocalRef(arr); } break; @@ -528,7 +528,7 @@ public: PoolVector<float>::Write w = sarr.write(); env->GetFloatArrayRegion(arr, 0, fCount, w.ptr()); - w = PoolVector<float>::Write(); + w.release(); ret = sarr; env->DeleteLocalRef(arr); } break; diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index ef7644fcab..bb144dda96 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -70,7 +70,7 @@ void CollisionPolygon2D::_build_polygon() { w[(i << 1) + 1] = polygon[(i + 1) % polygon.size()]; } - w = PoolVector<Vector2>::Write(); + w.release(); concave->set_segments(segments); parent->shape_owner_add_shape(owner_id, concave); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 22bc0e44e6..0a6d630428 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -1275,7 +1275,7 @@ PoolVector<int> TileMap::_get_tile_data() const { idx += 3; } - w = PoolVector<int>::Write(); + w.release(); return data; } diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index b9f6865298..386e127f8b 100644 --- a/scene/3d/soft_body.cpp +++ b/scene/3d/soft_body.cpp @@ -73,7 +73,7 @@ void SoftBodyVisualServerHandler::open() { } void SoftBodyVisualServerHandler::close() { - write_buffer = PoolVector<uint8_t>::Write(); + write_buffer.release(); } void SoftBodyVisualServerHandler::commit_changes() { diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index 9f73484b6a..d0f8799a64 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -254,7 +254,7 @@ Ref<TriangleMesh> SpriteBase3D::generate_triangle_mesh() const { facesw[j] = vtx; } - facesw = PoolVector<Vector3>::Write(); + facesw.release(); triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh)); triangle_mesh->create(faces); diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 1ca643cd7a..89cbf0becd 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -403,7 +403,7 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { w[idx++] = scale.z; } - w = PoolVector<real_t>::Write(); + w.release(); r_ret = keys; return true; @@ -438,8 +438,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { idx++; } - wti = PoolVector<float>::Write(); - wtr = PoolVector<float>::Write(); + wti.release(); + wtr.release(); d["times"] = key_times; d["transitions"] = key_transitions; @@ -478,8 +478,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { idx++; } - wti = PoolVector<float>::Write(); - wtr = PoolVector<float>::Write(); + wti.release(); + wtr.release(); d["times"] = key_times; d["transitions"] = key_transitions; @@ -523,8 +523,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { idx++; } - wti = PoolVector<float>::Write(); - wpo = PoolVector<float>::Write(); + wti.release(); + wpo.release(); d["times"] = key_times; d["points"] = key_points; @@ -562,7 +562,7 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { idx++; } - wti = PoolVector<float>::Write(); + wti.release(); d["times"] = key_times; d["clips"] = clips; @@ -595,8 +595,8 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { wcl[i] = vls[i].value; } - wti = PoolVector<float>::Write(); - wcl = PoolVector<String>::Write(); + wti.release(); + wcl.release(); d["times"] = key_times; d["clips"] = clips; diff --git a/scene/resources/dynamic_font_stb.cpp b/scene/resources/dynamic_font_stb.cpp index 3b44f05b94..ccff617a16 100644 --- a/scene/resources/dynamic_font_stb.cpp +++ b/scene/resources/dynamic_font_stb.cpp @@ -55,7 +55,7 @@ void DynamicFontData::lock() { void DynamicFontData::unlock() { - fr = PoolVector<uint8_t>::Read(); + fr.release(); } void DynamicFontData::set_font_data(const PoolVector<uint8_t> &p_font) { diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp index 6443b44bb6..aff274cd21 100644 --- a/scene/resources/mesh.cpp +++ b/scene/resources/mesh.cpp @@ -98,7 +98,7 @@ Ref<TriangleMesh> Mesh::generate_triangle_mesh() const { } } - facesw = PoolVector<Vector3>::Write(); + facesw.release(); triangle_mesh = Ref<TriangleMesh>(memnew(TriangleMesh)); triangle_mesh->create(faces); @@ -436,7 +436,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { r[i] = t; } - r = PoolVector<Vector3>::Write(); + r.release(); arrays[ARRAY_VERTEX] = vertices; if (!has_indices) { @@ -452,7 +452,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { iw[j + 2] = j + 1; } - iw = PoolVector<int>::Write(); + iw.release(); arrays[ARRAY_INDEX] = new_indices; } else { @@ -461,7 +461,7 @@ Ref<Mesh> Mesh::create_outline(float p_margin) const { SWAP(ir[j + 1], ir[j + 2]); } - ir = PoolVector<int>::Write(); + ir.release(); arrays[ARRAY_INDEX] = indices; } } diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 496b1b2bdc..2588e41951 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -307,7 +307,7 @@ Array SurfaceTool::commit_to_arrays() { } } - w = PoolVector<Vector3>::Write(); + w.release(); a[i] = array; } break; @@ -335,7 +335,7 @@ Array SurfaceTool::commit_to_arrays() { } } - w = PoolVector<Vector2>::Write(); + w.release(); a[i] = array; } break; case Mesh::ARRAY_TANGENT: { @@ -358,7 +358,7 @@ Array SurfaceTool::commit_to_arrays() { w[idx + 3] = d < 0 ? -1 : 1; } - w = PoolVector<float>::Write(); + w.release(); a[i] = array; } break; @@ -375,7 +375,7 @@ Array SurfaceTool::commit_to_arrays() { w[idx] = v.color; } - w = PoolVector<Color>::Write(); + w.release(); a[i] = array; } break; case Mesh::ARRAY_BONES: { @@ -396,7 +396,7 @@ Array SurfaceTool::commit_to_arrays() { } } - w = PoolVector<int>::Write(); + w.release(); a[i] = array; } break; @@ -418,7 +418,7 @@ Array SurfaceTool::commit_to_arrays() { } } - w = PoolVector<float>::Write(); + w.release(); a[i] = array; } break; @@ -436,7 +436,7 @@ Array SurfaceTool::commit_to_arrays() { w[idx] = E->get(); } - w = PoolVector<int>::Write(); + w.release(); a[i] = array; } break; diff --git a/servers/physics/shape_sw.cpp b/servers/physics/shape_sw.cpp index d40de669fd..8a52f29729 100644 --- a/servers/physics/shape_sw.cpp +++ b/servers/physics/shape_sw.cpp @@ -1524,8 +1524,8 @@ void ConcavePolygonShapeSW::_setup(PoolVector<Vector3> p_faces) { _aabb.merge_with(bvh_arrayw[i].aabb); } - w = PoolVector<Face>::Write(); - vw = PoolVector<Vector3>::Write(); + w.release(); + vw.release(); int count = 0; _VolumeSW_BVH *bvh_tree = _volume_sw_build_bvh(bvh_arrayw, src_face_count, count); diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 0043b948b0..48799a56fb 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -986,7 +986,7 @@ Variant ConcavePolygonShape2DSW::get_data() const { w[(i << 1) + 1] = points[segments[i].points[1]]; } - w = PoolVector<Vector2>::Write(); + w.release(); return rsegments; } diff --git a/servers/visual/visual_server_scene.cpp b/servers/visual/visual_server_scene.cpp index faf5a1f8fa..7c100be0f2 100644 --- a/servers/visual/visual_server_scene.cpp +++ b/servers/visual/visual_server_scene.cpp @@ -2396,7 +2396,7 @@ void VisualServerScene::_setup_gi_probe(Instance *p_instance) { mipmap.resize(size); PoolVector<uint8_t>::Write w = mipmap.write(); zeromem(w.ptr(), size); - w = PoolVector<uint8_t>::Write(); + w.release(); probe->dynamic.mipmaps_3d.push_back(mipmap); |