diff options
author | Juan Linietsky <juan@godotengine.org> | 2020-02-17 18:06:54 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-18 10:10:36 +0100 |
commit | 3205a92ad872f918c8322cdcd1434c231a1fd251 (patch) | |
tree | db44242ca27432eb8ea849679752d0835d2ae41a /scene/resources/texture.cpp | |
parent | fb8c93c10b4b73d5f18f1ed287497728800e22b5 (diff) | |
download | redot-engine-3205a92ad872f918c8322cdcd1434c231a1fd251.tar.gz |
PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
Diffstat (limited to 'scene/resources/texture.cpp')
-rw-r--r-- | scene/resources/texture.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index ff9c786b4c..60a9ca8f0f 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -388,11 +388,11 @@ Ref<Image> StreamTexture::load_image_from_file(FileAccess *f, int p_size_limit) continue; } - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(size); { - PoolVector<uint8_t>::Write wr = pv.write(); - f->get_buffer(wr.ptr(), size); + uint8_t *wr = pv.ptrw(); + f->get_buffer(wr, size); } Ref<Image> img; @@ -438,19 +438,19 @@ Ref<Image> StreamTexture::load_image_from_file(FileAccess *f, int p_size_limit) } else { //rarer use case, but needs to be supported - PoolVector<uint8_t> img_data; + Vector<uint8_t> img_data; img_data.resize(total_size); { - PoolVector<uint8_t>::Write wr = img_data.write(); + uint8_t *wr = img_data.ptrw(); int ofs = 0; for (int i = 0; i < mipmap_images.size(); i++) { - PoolVector<uint8_t> id = mipmap_images[i]->get_data(); + Vector<uint8_t> id = mipmap_images[i]->get_data(); int len = id.size(); - PoolVector<uint8_t>::Read r = id.read(); - copymem(&wr[ofs], r.ptr(), len); + const uint8_t *r = id.ptr(); + copymem(&wr[ofs], r, len); ofs += len; } } @@ -474,12 +474,12 @@ Ref<Image> StreamTexture::load_image_from_file(FileAccess *f, int p_size_limit) continue; //oops, size limit enforced, go to next } - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(size - ofs); { - PoolVector<uint8_t>::Write wr = data.write(); - f->get_buffer(wr.ptr(), data.size()); + uint8_t *wr = data.ptrw(); + f->get_buffer(wr, data.size()); } Ref<Image> image; @@ -1422,13 +1422,13 @@ void CurveTexture::set_curve(Ref<Curve> p_curve) { void CurveTexture::_update() { - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(_width * sizeof(float)); // The array is locked in that scope { - PoolVector<uint8_t>::Write wd8 = data.write(); - float *wd = (float *)wd8.ptr(); + uint8_t *wd8 = data.ptrw(); + float *wd = (float *)wd8; if (_curve.is_valid()) { Curve &curve = **_curve; @@ -1545,10 +1545,10 @@ void GradientTexture::_update() { if (gradient.is_null()) return; - PoolVector<uint8_t> data; + Vector<uint8_t> data; data.resize(width * 4); { - PoolVector<uint8_t>::Write wd8 = data.write(); + uint8_t *wd8 = data.ptrw(); Gradient &g = **gradient; for (int i = 0; i < width; i++) { @@ -2096,11 +2096,11 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String for (int i = 0; i < mipmaps; i++) { uint32_t size = f->get_32(); - PoolVector<uint8_t> pv; + Vector<uint8_t> pv; pv.resize(size); { - PoolVector<uint8_t>::Write w = pv.write(); - f->get_buffer(w.ptr(), size); + uint8_t *w = pv.ptrw(); + f->get_buffer(w, size); } Ref<Image> img = Image::lossless_unpacker(pv); @@ -2123,19 +2123,19 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String } else { int total_size = Image::get_image_data_size(tw, th, format, true); - PoolVector<uint8_t> img_data; + Vector<uint8_t> img_data; img_data.resize(total_size); { - PoolVector<uint8_t>::Write w = img_data.write(); + uint8_t *w = img_data.ptrw(); int ofs = 0; for (int i = 0; i < mipmap_images.size(); i++) { - PoolVector<uint8_t> id = mipmap_images[i]->get_data(); + Vector<uint8_t> id = mipmap_images[i]->get_data(); int len = id.size(); - PoolVector<uint8_t>::Read r = id.read(); - copymem(&w[ofs], r.ptr(), len); + const uint8_t *r = id.ptr(); + copymem(&w[ofs], r, len); ofs += len; } } @@ -2157,12 +2157,12 @@ RES ResourceFormatLoaderTextureLayered::load(const String &p_path, const String int total_size = Image::get_image_data_size(tw, th, format, use_mipmaps); - PoolVector<uint8_t> img_data; + Vector<uint8_t> img_data; img_data.resize(total_size); { - PoolVector<uint8_t>::Write w = img_data.write(); - int bytes = f->get_buffer(w.ptr(), total_size); + uint8_t *w = img_data.ptrw(); + int bytes = f->get_buffer(w, total_size); if (bytes != total_size) { if (r_error) { *r_error = ERR_FILE_CORRUPT; |