diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-01-07 18:25:37 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-01-07 18:26:38 -0300 |
commit | 2ab83e1abbf5ee6d00e16056a9e9394114026f28 (patch) | |
tree | 7efbb375cc4d00d8e8589fcf1b6a1303bec5df2d /modules | |
parent | 2a38a5eaa844043b846e03d6655f84caf8a31e74 (diff) |
Memory pool vectors (DVector) have been enormously simplified in code, and renamed to PoolVector
Diffstat (limited to 'modules')
-rw-r--r-- | modules/chibi/event_stream_chibi.cpp | 4 | ||||
-rw-r--r-- | modules/chibi/event_stream_chibi.h | 4 | ||||
-rw-r--r-- | modules/dds/texture_loader_dds.cpp | 14 | ||||
-rw-r--r-- | modules/etc1/image_etc.cpp | 18 | ||||
-rw-r--r-- | modules/etc1/texture_loader_pkm.cpp | 6 | ||||
-rw-r--r-- | modules/gdscript/gd_script.cpp | 4 | ||||
-rw-r--r-- | modules/gridmap/grid_map.cpp | 24 | ||||
-rw-r--r-- | modules/gridmap/grid_map_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | modules/jpg/image_loader_jpegd.cpp | 12 | ||||
-rw-r--r-- | modules/mpc/audio_stream_mpc.cpp | 4 | ||||
-rw-r--r-- | modules/mpc/audio_stream_mpc.h | 2 | ||||
-rw-r--r-- | modules/pbm/bitmap_loader_pbm.cpp | 20 | ||||
-rw-r--r-- | modules/pvr/texture_loader_pvr.cpp | 24 | ||||
-rw-r--r-- | modules/squish/image_compress_squish.cpp | 10 | ||||
-rw-r--r-- | modules/theora/video_stream_theora.cpp | 10 | ||||
-rw-r--r-- | modules/theora/video_stream_theora.h | 2 | ||||
-rw-r--r-- | modules/webm/video_stream_webm.cpp | 2 | ||||
-rw-r--r-- | modules/webm/video_stream_webm.h | 2 | ||||
-rw-r--r-- | modules/webp/image_loader_webp.cpp | 42 |
19 files changed, 105 insertions, 105 deletions
diff --git a/modules/chibi/event_stream_chibi.cpp b/modules/chibi/event_stream_chibi.cpp index 0b680b4fda..73d1c01e33 100644 --- a/modules/chibi/event_stream_chibi.cpp +++ b/modules/chibi/event_stream_chibi.cpp @@ -298,9 +298,9 @@ void CPSampleManagerImpl::unlock_data(CPSample_ID p_id){ sd->locks--; if (sd->locks==0) { - sd->w=DVector<uint8_t>::Write(); + sd->w=PoolVector<uint8_t>::Write(); AudioServer::get_singleton()->sample_set_data(sd->rid,sd->lock); - sd->lock=DVector<uint8_t>(); + sd->lock=PoolVector<uint8_t>(); } } diff --git a/modules/chibi/event_stream_chibi.h b/modules/chibi/event_stream_chibi.h index 9c6c883f61..0244ee0a95 100644 --- a/modules/chibi/event_stream_chibi.h +++ b/modules/chibi/event_stream_chibi.h @@ -54,8 +54,8 @@ class CPSampleManagerImpl : public CPSampleManager { int loop_begin; int loop_end; int locks; - DVector<uint8_t> lock; - DVector<uint8_t>::Write w; + PoolVector<uint8_t> lock; + PoolVector<uint8_t>::Write w; CPSample_Loop_Type loop_type; }; diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp index 598b2aab0e..1de98a6b1f 100644 --- a/modules/dds/texture_loader_dds.cpp +++ b/modules/dds/texture_loader_dds.cpp @@ -223,7 +223,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, // print_line("found format: "+String(dds_format_info[dds_format].name)); - DVector<uint8_t> src_data; + PoolVector<uint8_t> src_data; const DDSFormatInfo &info=dds_format_info[dds_format]; uint32_t w = width; @@ -247,9 +247,9 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } src_data.resize(size); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); } else if (info.palette) { @@ -281,7 +281,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } src_data.resize(size + 256*colsize ); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); for(int i=0;i<256;i++) { @@ -296,7 +296,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); } else { //uncompressed generic... @@ -316,7 +316,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, size=size*2; src_data.resize(size); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); @@ -449,7 +449,7 @@ RES ResourceFormatDDS::load(const String &p_path, const String& p_original_path, } - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); } diff --git a/modules/etc1/image_etc.cpp b/modules/etc1/image_etc.cpp index 4bbdc0a60a..845084fef7 100644 --- a/modules/etc1/image_etc.cpp +++ b/modules/etc1/image_etc.cpp @@ -37,10 +37,10 @@ static void _decompress_etc(Image *p_img) { int imgw = p_img->get_width(); int imgh = p_img->get_height(); - DVector<uint8_t> src=p_img->get_data(); - DVector<uint8_t> dst; + PoolVector<uint8_t> src=p_img->get_data(); + PoolVector<uint8_t> dst; - DVector<uint8_t>::Read r = src.read(); + PoolVector<uint8_t>::Read r = src.read(); int mmc=p_img->get_mipmap_count(); @@ -49,7 +49,7 @@ static void _decompress_etc(Image *p_img) { dst.resize(dst.size()+imgw*imgh*3); const uint8_t *srcbr=&r[p_img->get_mipmap_offset(i)]; - DVector<uint8_t>::Write w = dst.write(); + PoolVector<uint8_t>::Write w = dst.write(); uint8_t *wptr = &w[dst.size()-imgw*imgh*3]; @@ -91,7 +91,7 @@ static void _decompress_etc(Image *p_img) { } - r=DVector<uint8_t>::Read(); + r=PoolVector<uint8_t>::Read(); //print_line("Re Creating ETC into regular image: w "+itos(p_img->get_width())+" h "+itos(p_img->get_height())+" mm "+itos(p_img->get_mipmaps())); *p_img=Image(p_img->get_width(),p_img->get_height(),p_img->has_mipmaps(),Image::FORMAT_RGB8,dst); if (p_img->has_mipmaps()) @@ -117,9 +117,9 @@ static void _compress_etc(Image *p_img) { img.generate_mipmaps(); // force mipmaps, so it works on most hardware - DVector<uint8_t> res_data; - DVector<uint8_t> dst_data; - DVector<uint8_t>::Read r = img.get_data().read(); + PoolVector<uint8_t> res_data; + PoolVector<uint8_t> dst_data; + PoolVector<uint8_t>::Read r = img.get_data().read(); int mc=0; @@ -134,7 +134,7 @@ static void _compress_etc(Image *p_img) { const uint8_t *src = &r[img.get_mipmap_offset(i)]; int mmsize = MAX(bw,1)*MAX(bh,1)*8; dst_data.resize(dst_data.size()+mmsize); - DVector<uint8_t>::Write w=dst_data.write(); + PoolVector<uint8_t>::Write w=dst_data.write(); uint8_t *dst = &w[dst_data.size()-mmsize]; diff --git a/modules/etc1/texture_loader_pkm.cpp b/modules/etc1/texture_loader_pkm.cpp index f8af141979..42c9937b8f 100644 --- a/modules/etc1/texture_loader_pkm.cpp +++ b/modules/etc1/texture_loader_pkm.cpp @@ -43,13 +43,13 @@ RES ResourceFormatPKM::load(const String &p_path, const String& p_original_path, h.origWidth = f->get_16(); h.origHeight = f->get_16(); - DVector<uint8_t> src_data; + PoolVector<uint8_t> src_data; uint32_t size = h.texWidth * h.texHeight / 2; src_data.resize(size); - DVector<uint8_t>::Write wb = src_data.write(); + PoolVector<uint8_t>::Write wb = src_data.write(); f->get_buffer(wb.ptr(),size); - wb=DVector<uint8_t>::Write(); + wb=PoolVector<uint8_t>::Write(); int mipmaps = h.format; int width = h.origWidth; diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index b205a0a890..5fe97335f0 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -830,7 +830,7 @@ Error GDScript::load_byte_code(const String& p_path) { Error GDScript::load_source_code(const String& p_path) { - DVector<uint8_t> sourcef; + PoolVector<uint8_t> sourcef; Error err; FileAccess *f=FileAccess::open(p_path,FileAccess::READ,&err); if (err) { @@ -840,7 +840,7 @@ Error GDScript::load_source_code(const String& p_path) { int len = f->get_len(); sourcef.resize(len+1); - DVector<uint8_t>::Write w = sourcef.write(); + PoolVector<uint8_t>::Write w = sourcef.write(); int r = f->get_buffer(w.ptr(),len); f->close(); memdelete(f); diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 84d8250033..b934e7ab1b 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -61,9 +61,9 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) { } else if (name=="theme/bake") { set_bake(p_value); /* } else if (name=="cells") { - DVector<int> cells = p_value; + PoolVector<int> cells = p_value; int amount=cells.size(); - DVector<int>::Read r = cells.read(); + PoolVector<int>::Read r = cells.read(); ERR_FAIL_COND_V(amount&1,false); // not even cell_map.clear();; for(int i=0;i<amount/3;i++) { @@ -86,9 +86,9 @@ bool GridMap::_set(const StringName& p_name, const Variant& p_value) { baked=d["baked"]; if (d.has("cells")) { - DVector<int> cells = d["cells"]; + PoolVector<int> cells = d["cells"]; int amount=cells.size(); - DVector<int>::Read r = cells.read(); + PoolVector<int>::Read r = cells.read(); ERR_FAIL_COND_V(amount%3,false); // not even cell_map.clear();; for(int i=0;i<amount/3;i++) { @@ -183,10 +183,10 @@ bool GridMap::_get(const StringName& p_name,Variant &r_ret) const { Dictionary d; - DVector<int> cells; + PoolVector<int> cells; cells.resize(cell_map.size()*3); { - DVector<int>::Write w = cells.write(); + PoolVector<int>::Write w = cells.write(); int i=0; for (Map<IndexKey,Cell>::Element *E=cell_map.front();E;E=E->next(),i++) { @@ -665,7 +665,7 @@ void GridMap::_octant_update(const OctantKey &p_key) { VS::get_singleton()->mesh_clear(g.collision_debug); } - DVector<Vector3> col_debug; + PoolVector<Vector3> col_debug; /* * foreach item in this octant, @@ -863,15 +863,15 @@ void GridMap::_octant_bake(const OctantKey &p_key, const Ref<TriangleMesh>& p_tm if (ii.mesh->surface_get_primitive_type(i)!=Mesh::PRIMITIVE_TRIANGLES) continue; Array a = ii.mesh->surface_get_arrays(i); - DVector<Vector3> av=a[VS::ARRAY_VERTEX]; + PoolVector<Vector3> av=a[VS::ARRAY_VERTEX]; int avs = av.size(); - DVector<Vector3>::Read vr = av.read(); + PoolVector<Vector3>::Read vr = av.read(); - DVector<int> ai=a[VS::ARRAY_INDEX]; + PoolVector<int> ai=a[VS::ARRAY_INDEX]; int ais=ai.size(); if (ais) { - DVector<int>::Read ir=ai.read(); + PoolVector<int>::Read ir=ai.read(); for(int j=0;j<ais;j++) { p_prebake->push_back(xform.xform(vr[ir[j]])); @@ -1667,7 +1667,7 @@ void GridMap::bake_geometry() { } - DVector<Vector3> vv; + PoolVector<Vector3> vv; vv.fill_with(vertices); //print_line("TOTAL VERTICES: "+itos(vv.size())); tmesh = Ref<TriangleMesh>( memnew( TriangleMesh )); diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index 08f2c4fbbc..db0952b1cb 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -1126,7 +1126,7 @@ void GridMapEditor::_update_areas_display() { RID mesh = VisualServer::get_singleton()->mesh_create(); - DVector<Plane> planes; + PoolVector<Plane> planes; for(int i=0;i<3;i++) { Vector3 axis; @@ -1343,8 +1343,8 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) { //selection mesh create - DVector<Vector3> lines; - DVector<Vector3> triangles; + PoolVector<Vector3> lines; + PoolVector<Vector3> triangles; for (int i=0;i<6;i++) { diff --git a/modules/jpg/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp index 9709c0c706..1152d42e1b 100644 --- a/modules/jpg/image_loader_jpegd.cpp +++ b/modules/jpg/image_loader_jpegd.cpp @@ -56,11 +56,11 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_ const int dst_bpl = image_width * comps; - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(dst_bpl * image_height); - DVector<uint8_t>::Write dw = data.write(); + PoolVector<uint8_t>::Write dw = data.write(); jpgd::uint8 *pImage_data = (jpgd::uint8*)dw.ptr(); @@ -88,7 +88,7 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_ else fmt=Image::FORMAT_RGBA8; - dw = DVector<uint8_t>::Write(); + dw = PoolVector<uint8_t>::Write(); p_image->create(image_width,image_height,0,fmt,data); return OK; @@ -99,12 +99,12 @@ Error jpeg_load_image_from_buffer(Image *p_image,const uint8_t* p_buffer, int p_ Error ImageLoaderJPG::load_image(Image *p_image,FileAccess *f) { - DVector<uint8_t> src_image; + PoolVector<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); - DVector<uint8_t>::Write w = src_image.write(); + PoolVector<uint8_t>::Write w = src_image.write(); f->get_buffer(&w[0],src_image_len); @@ -113,7 +113,7 @@ Error ImageLoaderJPG::load_image(Image *p_image,FileAccess *f) { Error err = jpeg_load_image_from_buffer(p_image,w.ptr(),src_image_len); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); return err; diff --git a/modules/mpc/audio_stream_mpc.cpp b/modules/mpc/audio_stream_mpc.cpp index d8572d3b5d..bcb7e4c871 100644 --- a/modules/mpc/audio_stream_mpc.cpp +++ b/modules/mpc/audio_stream_mpc.cpp @@ -59,7 +59,7 @@ Error AudioStreamPlaybackMPC::_open_file() { if (preload) { data.resize(streamlen); - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); f->get_buffer(&w[0],streamlen); memdelete(f); f=NULL; @@ -85,7 +85,7 @@ int AudioStreamPlaybackMPC::_read_file(void *p_dst,int p_bytes) { if (f) return f->get_buffer((uint8_t*)p_dst,p_bytes); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t>::Read r = data.read(); if (p_bytes+data_ofs > streamlen) { p_bytes=streamlen-data_ofs; } diff --git a/modules/mpc/audio_stream_mpc.h b/modules/mpc/audio_stream_mpc.h index e7d677aa8c..5330fa055f 100644 --- a/modules/mpc/audio_stream_mpc.h +++ b/modules/mpc/audio_stream_mpc.h @@ -43,7 +43,7 @@ class AudioStreamPlaybackMPC : public AudioStreamPlayback { bool preload; FileAccess *f; String file; - DVector<uint8_t> data; + PoolVector<uint8_t> data; int data_ofs; int streamlen; diff --git a/modules/pbm/bitmap_loader_pbm.cpp b/modules/pbm/bitmap_loader_pbm.cpp index f9fc19b2cc..6caaf10334 100644 --- a/modules/pbm/bitmap_loader_pbm.cpp +++ b/modules/pbm/bitmap_loader_pbm.cpp @@ -31,11 +31,11 @@ #include "scene/resources/bit_mask.h" -static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token,bool p_binary=false,bool p_single_chunk=false) { +static bool _get_token(FileAccessRef& f,uint8_t &saved,PoolVector<uint8_t>& r_token,bool p_binary=false,bool p_single_chunk=false) { int token_max = r_token.size(); - DVector<uint8_t>::Write w; + PoolVector<uint8_t>::Write w; if (token_max) w=r_token.write(); int ofs=0; @@ -53,7 +53,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token } if (f->eof_reached()) { if (ofs) { - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_token.resize(ofs); return true; } else { @@ -81,7 +81,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token if (ofs && !p_single_chunk) { - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_token.resize(ofs); saved=b; @@ -98,7 +98,7 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token resized=true; } if (resized) { - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); r_token.resize(token_max); w=r_token.write(); } @@ -109,10 +109,10 @@ static bool _get_token(FileAccessRef& f,uint8_t &saved,DVector<uint8_t>& r_token return false; } -static int _get_number_from_token(DVector<uint8_t>& r_token) { +static int _get_number_from_token(PoolVector<uint8_t>& r_token) { int len = r_token.size(); - DVector<uint8_t>::Read r = r_token.read(); + PoolVector<uint8_t>::Read r = r_token.read(); return String::to_int((const char*)r.ptr(),len); } @@ -133,7 +133,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E if (!f) _RETURN(ERR_CANT_OPEN); - DVector<uint8_t> token; + PoolVector<uint8_t> token; if (!_get_token(f,saved,token)) { _RETURN(ERR_PARSE_ERROR); @@ -186,7 +186,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E _RETURN(ERR_FILE_CORRUPT); } - DVector<uint8_t>::Read r=token.read(); + PoolVector<uint8_t>::Read r=token.read(); for(int i=0;i<height;i++) { for(int j=0;j<width;j++) { @@ -210,7 +210,7 @@ RES ResourceFormatPBM::load(const String &p_path,const String& p_original_path,E _RETURN(ERR_FILE_CORRUPT); } - DVector<uint8_t>::Read r=token.read(); + PoolVector<uint8_t>::Read r=token.read(); int bitwidth = width; if (bitwidth % 8) bitwidth+=8-(bitwidth%8); diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp index 0b07e05410..9f8db98e05 100644 --- a/modules/pvr/texture_loader_pvr.cpp +++ b/modules/pvr/texture_loader_pvr.cpp @@ -99,13 +99,13 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E print_line("surfcount: "+itos(surfcount)); */ - DVector<uint8_t> data; + PoolVector<uint8_t> data; data.resize(surfsize); ERR_FAIL_COND_V(data.size()==0,RES()); - DVector<uint8_t>::Write w = data.write(); + PoolVector<uint8_t>::Write w = data.write(); f->get_buffer(&w[0],surfsize); err = f->get_error(); ERR_FAIL_COND_V(err!=OK,RES()); @@ -151,7 +151,7 @@ RES ResourceFormatPVR::load(const String &p_path,const String& p_original_path,E } - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); int tex_flags=Texture::FLAG_FILTER|Texture::FLAG_REPEAT; @@ -209,10 +209,10 @@ static void _compress_pvrtc4(Image * p_img) { Image new_img; new_img.create(img.get_width(),img.get_height(),true,use_alpha?Image::FORMAT_PVRTC4A:Image::FORMAT_PVRTC4); - DVector<uint8_t> data=new_img.get_data(); + PoolVector<uint8_t> data=new_img.get_data(); { - DVector<uint8_t>::Write wr=data.write(); - DVector<uint8_t>::Read r=img.get_data().read(); + PoolVector<uint8_t>::Write wr=data.write(); + PoolVector<uint8_t>::Read r=img.get_data().read(); for(int i=0;i<=new_img.get_mipmap_count();i++) { @@ -677,13 +677,13 @@ static void _pvrtc_decompress(Image* p_img) { bool _2bit = (p_img->get_format()==Image::FORMAT_PVRTC2 || p_img->get_format()==Image::FORMAT_PVRTC2A ); - DVector<uint8_t> data = p_img->get_data(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t> data = p_img->get_data(); + PoolVector<uint8_t>::Read r = data.read(); - DVector<uint8_t> newdata; + PoolVector<uint8_t> newdata; newdata.resize( p_img->get_width() * p_img->get_height() * 4); - DVector<uint8_t>::Write w=newdata.write(); + PoolVector<uint8_t>::Write w=newdata.write(); decompress_pvrtc((PVRTCBlock*)r.ptr(),_2bit,p_img->get_width(),p_img->get_height(),0,(unsigned char*)w.ptr()); @@ -691,8 +691,8 @@ static void _pvrtc_decompress(Image* p_img) { // print_line(itos(w[i])); //} - w=DVector<uint8_t>::Write(); - r=DVector<uint8_t>::Read(); + w=PoolVector<uint8_t>::Write(); + r=PoolVector<uint8_t>::Read(); bool make_mipmaps=p_img->has_mipmaps(); Image newimg(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 6cd9048f1b..7410658603 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -66,12 +66,12 @@ void image_compress_squish(Image *p_image) { int mm_count = p_image->get_mipmap_count(); - DVector<uint8_t> data; + PoolVector<uint8_t> data; int target_size = Image::get_image_data_size(w,h,target_format,mm_count); data.resize(target_size); - DVector<uint8_t>::Read rb = p_image->get_data().read(); - DVector<uint8_t>::Write wb = data.write(); + PoolVector<uint8_t>::Read rb = p_image->get_data().read(); + PoolVector<uint8_t>::Write wb = data.write(); int dst_ofs=0; @@ -84,8 +84,8 @@ void image_compress_squish(Image *p_image) { h>>=1; } - rb = DVector<uint8_t>::Read(); - wb = DVector<uint8_t>::Write(); + rb = PoolVector<uint8_t>::Read(); + wb = PoolVector<uint8_t>::Write(); p_image->create(p_image->get_width(),p_image->get_height(),p_image->has_mipmaps(),target_format,data); diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp index e6bf55185e..b847f17bb7 100644 --- a/modules/theora/video_stream_theora.cpp +++ b/modules/theora/video_stream_theora.cpp @@ -88,7 +88,7 @@ void VideoStreamPlaybackTheora::video_write(void){ { int pixels = size.x * size.y; frame_data.resize(pixels * 4); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); int p = 0; for (int i=0; i<size.y; i++) { @@ -112,7 +112,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 4; frame_data.resize(size.x * size.y * pitch); { - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); //uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y/2); @@ -143,7 +143,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 3; frame_data.resize(size.x * size.y * pitch); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); for(int i=0;i<size.y;i++) { @@ -174,7 +174,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 4; frame_data.resize(size.x * size.y * pitch); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div); @@ -208,7 +208,7 @@ void VideoStreamPlaybackTheora::video_write(void){ int pitch = 2; frame_data.resize(size.x * size.y * pitch); - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); char* dst = (char*)w.ptr(); uv_offset=(ti.pic_x/2)+(yuv[1].stride)*(ti.pic_y / div); diff --git a/modules/theora/video_stream_theora.h b/modules/theora/video_stream_theora.h index bff9d2538d..0e1f5fa864 100644 --- a/modules/theora/video_stream_theora.h +++ b/modules/theora/video_stream_theora.h @@ -51,7 +51,7 @@ class VideoStreamPlaybackTheora : public VideoStreamPlayback { //Image frames[MAX_FRAMES]; Image::Format format; - DVector<uint8_t> frame_data; + PoolVector<uint8_t> frame_data; int frames_pending; FileAccess* file; String file_name; diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp index 35b215cb52..d132e89690 100644 --- a/modules/webm/video_stream_webm.cpp +++ b/modules/webm/video_stream_webm.cpp @@ -293,7 +293,7 @@ void VideoStreamPlaybackWebm::update(float p_delta) { if (err == VPXDecoder::NO_ERROR && image.w == webm->getWidth() && image.h == webm->getHeight()) { - DVector<uint8_t>::Write w = frame_data.write(); + PoolVector<uint8_t>::Write w = frame_data.write(); bool converted = false; if (image.chromaShiftW == 1 && image.chromaShiftH == 1) { diff --git a/modules/webm/video_stream_webm.h b/modules/webm/video_stream_webm.h index a34591d9b9..cb4ef53f6d 100644 --- a/modules/webm/video_stream_webm.h +++ b/modules/webm/video_stream_webm.h @@ -56,7 +56,7 @@ class VideoStreamPlaybackWebm : public VideoStreamPlayback { double delay_compensation; double time, video_frame_delay, video_pos; - DVector<uint8_t> frame_data; + PoolVector<uint8_t> frame_data; Ref<ImageTexture> texture; int16_t *pcm; diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp index 56fc386ef4..3508c6a663 100644 --- a/modules/webp/image_loader_webp.cpp +++ b/modules/webp/image_loader_webp.cpp @@ -36,9 +36,9 @@ #include <webp/decode.h> #include <webp/encode.h> -static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { +static PoolVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { - ERR_FAIL_COND_V(p_image.empty(),DVector<uint8_t>()); + ERR_FAIL_COND_V(p_image.empty(),PoolVector<uint8_t>()); Image img=p_image; if (img.detect_alpha()) @@ -47,8 +47,8 @@ static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { img.convert(Image::FORMAT_RGB8); Size2 s(img.get_width(),img.get_height()); - DVector<uint8_t> data = img.get_data(); - DVector<uint8_t>::Read r = data.read(); + PoolVector<uint8_t> data = img.get_data(); + PoolVector<uint8_t>::Read r = data.read(); uint8_t *dst_buff=NULL; size_t dst_size=0; @@ -59,25 +59,25 @@ static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) { dst_size = WebPEncodeRGBA(r.ptr(),s.width,s.height,4*s.width,CLAMP(p_quality*100.0,0,100.0),&dst_buff); } - ERR_FAIL_COND_V(dst_size==0,DVector<uint8_t>()); - DVector<uint8_t> dst; + ERR_FAIL_COND_V(dst_size==0,PoolVector<uint8_t>()); + PoolVector<uint8_t> dst; dst.resize(4+dst_size); - DVector<uint8_t>::Write w = dst.write(); + PoolVector<uint8_t>::Write w = dst.write(); w[0]='W'; w[1]='E'; w[2]='B'; w[3]='P'; copymem(&w[4],dst_buff,dst_size); free(dst_buff); - w=DVector<uint8_t>::Write(); + w=PoolVector<uint8_t>::Write(); return dst; } -static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { +static Image _webp_lossy_unpack(const PoolVector<uint8_t>& p_buffer) { int size = p_buffer.size()-4; ERR_FAIL_COND_V(size<=0,Image()); - DVector<uint8_t>::Read r = p_buffer.read(); + PoolVector<uint8_t>::Read r = p_buffer.read(); ERR_FAIL_COND_V(r[0]!='W' || r[1]!='E' || r[2]!='B' || r[3]!='P',Image()); WebPBitstreamFeatures features; @@ -90,11 +90,11 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { //print_line("height: "+itos(features.height)); //print_line("alpha: "+itos(features.has_alpha)); - DVector<uint8_t> dst_image; + PoolVector<uint8_t> dst_image; int datasize = features.width*features.height*(features.has_alpha?4:3); dst_image.resize(datasize); - DVector<uint8_t>::Write dst_w = dst_image.write(); + PoolVector<uint8_t>::Write dst_w = dst_image.write(); bool errdec=false; if (features.has_alpha) { @@ -107,7 +107,7 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) { //ERR_EXPLAIN("Error decoding webp! - "+p_file); ERR_FAIL_COND_V(errdec,Image()); - dst_w = DVector<uint8_t>::Write(); + dst_w = PoolVector<uint8_t>::Write(); return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image); @@ -118,12 +118,12 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { uint32_t size = f->get_len(); - DVector<uint8_t> src_image; + PoolVector<uint8_t> src_image; src_image.resize(size); WebPBitstreamFeatures features; - DVector<uint8_t>::Write src_w = src_image.write(); + PoolVector<uint8_t>::Write src_w = src_image.write(); f->get_buffer(src_w.ptr(),size); ERR_FAIL_COND_V(f->eof_reached(), ERR_FILE_EOF); @@ -137,14 +137,14 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { print_line("height: "+itos(features.height)); print_line("alpha: "+itos(features.has_alpha)); - src_w = DVector<uint8_t>::Write(); + src_w = PoolVector<uint8_t>::Write(); - DVector<uint8_t> dst_image; + PoolVector<uint8_t> dst_image; int datasize = features.width*features.height*(features.has_alpha?4:3); dst_image.resize(datasize); - DVector<uint8_t>::Read src_r = src_image.read(); - DVector<uint8_t>::Write dst_w = dst_image.write(); + PoolVector<uint8_t>::Read src_r = src_image.read(); + PoolVector<uint8_t>::Write dst_w = dst_image.write(); bool errdec=false; @@ -158,8 +158,8 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) { //ERR_EXPLAIN("Error decoding webp! - "+p_file); ERR_FAIL_COND_V(errdec,ERR_FILE_CORRUPT); - src_r = DVector<uint8_t>::Read(); - dst_w = DVector<uint8_t>::Write(); + src_r = PoolVector<uint8_t>::Read(); + dst_w = PoolVector<uint8_t>::Write(); *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image); |