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 /platform | |
parent | 2a38a5eaa844043b846e03d6655f84caf8a31e74 (diff) |
Memory pool vectors (DVector) have been enormously simplified in code, and renamed to PoolVector
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/godot_android.cpp | 24 | ||||
-rw-r--r-- | platform/android/java_glue.cpp | 40 | ||||
-rw-r--r-- | platform/iphone/rasterizer_iphone.cpp | 26 | ||||
-rw-r--r-- | platform/javascript/audio_server_javascript.cpp | 8 | ||||
-rw-r--r-- | platform/javascript/audio_server_javascript.h | 4 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 4 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 2 | ||||
-rw-r--r-- | platform/x11/os_x11.cpp | 2 |
8 files changed, 55 insertions, 55 deletions
diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index 715021db33..c4d1a85c5f 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -153,7 +153,7 @@ public: } break; case Variant::STRING_ARRAY: { - DVector<String> sarray = *p_args[i]; + PoolVector<String> sarray = *p_args[i]; jobjectArray arr = env->NewObjectArray(sarray.size(),env->FindClass("java/lang/String"),env->NewStringUTF("")); for(int j=0;j<sarray.size();j++) { @@ -165,18 +165,18 @@ public: } break; case Variant::INT_ARRAY: { - DVector<int> array = *p_args[i]; + PoolVector<int> array = *p_args[i]; jintArray arr = env->NewIntArray(array.size()); - DVector<int>::Read r = array.read(); + PoolVector<int>::Read r = array.read(); env->SetIntArrayRegion(arr,0,array.size(),r.ptr()); v[i].l=arr; } break; case Variant::REAL_ARRAY: { - DVector<float> array = *p_args[i]; + PoolVector<float> array = *p_args[i]; jfloatArray arr = env->NewFloatArray(array.size()); - DVector<float>::Read r = array.read(); + PoolVector<float>::Read r = array.read(); env->SetFloatArrayRegion(arr,0,array.size(),r.ptr()); v[i].l=arr; @@ -225,7 +225,7 @@ public: jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance,E->get().method,v); int stringCount = env->GetArrayLength(arr); - DVector<String> sarr; + PoolVector<String> sarr; for (int i=0; i<stringCount; i++) { jstring string = (jstring) env->GetObjectArrayElement(arr, i); @@ -241,12 +241,12 @@ public: jintArray arr = (jintArray)env->CallObjectMethodA(instance,E->get().method,v); int fCount = env->GetArrayLength(arr); - DVector<int> sarr; + PoolVector<int> sarr; sarr.resize(fCount); - DVector<int>::Write w = sarr.write(); + PoolVector<int>::Write w = sarr.write(); env->GetIntArrayRegion(arr,0,fCount,w.ptr()); - w = DVector<int>::Write(); + w = PoolVector<int>::Write(); ret=sarr; } break; case Variant::REAL_ARRAY: { @@ -254,12 +254,12 @@ public: jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance,E->get().method,v); int fCount = env->GetArrayLength(arr); - DVector<float> sarr; + PoolVector<float> sarr; sarr.resize(fCount); - DVector<float>::Write w = sarr.write(); + PoolVector<float>::Write w = sarr.write(); env->GetFloatArrayRegion(arr,0,fCount,w.ptr()); - w = DVector<float>::Write(); + w = PoolVector<float>::Write(); ret=sarr; } break; default: { diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 602d22dfa2..6d47946263 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -122,7 +122,7 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a } break; case Variant::STRING_ARRAY: { - DVector<String> sarray = *p_arg; + PoolVector<String> sarray = *p_arg; jobjectArray arr = env->NewObjectArray(sarray.size(),env->FindClass("java/lang/String"),env->NewStringUTF("")); for(int j=0;j<sarray.size();j++) { @@ -181,18 +181,18 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a case Variant::INT_ARRAY: { - DVector<int> array = *p_arg; + PoolVector<int> array = *p_arg; jintArray arr = env->NewIntArray(array.size()); - DVector<int>::Read r = array.read(); + PoolVector<int>::Read r = array.read(); env->SetIntArrayRegion(arr,0,array.size(),r.ptr()); v.val.l=arr; v.obj=arr; } break; case Variant::RAW_ARRAY: { - DVector<uint8_t> array = *p_arg; + PoolVector<uint8_t> array = *p_arg; jbyteArray arr = env->NewByteArray(array.size()); - DVector<uint8_t>::Read r = array.read(); + PoolVector<uint8_t>::Read r = array.read(); env->SetByteArrayRegion(arr,0,array.size(),reinterpret_cast<const signed char*>(r.ptr())); v.val.l=arr; v.obj=arr; @@ -200,9 +200,9 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant* p_a } break; case Variant::REAL_ARRAY: { - DVector<float> array = *p_arg; + PoolVector<float> array = *p_arg; jfloatArray arr = env->NewFloatArray(array.size()); - DVector<float>::Read r = array.read(); + PoolVector<float>::Read r = array.read(); env->SetFloatArrayRegion(arr,0,array.size(),r.ptr()); v.val.l=arr; v.obj=arr; @@ -259,7 +259,7 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) { jobjectArray arr = (jobjectArray)obj; int stringCount = env->GetArrayLength(arr); //print_line("String array! " + String::num(stringCount)); - DVector<String> sarr; + PoolVector<String> sarr; for (int i=0; i<stringCount; i++) { jstring string = (jstring) env->GetObjectArrayElement(arr, i); @@ -290,12 +290,12 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) { jintArray arr = (jintArray)obj; int fCount = env->GetArrayLength(arr); - DVector<int> sarr; + PoolVector<int> sarr; sarr.resize(fCount); - DVector<int>::Write w = sarr.write(); + PoolVector<int>::Write w = sarr.write(); env->GetIntArrayRegion(arr,0,fCount,w.ptr()); - w = DVector<int>::Write(); + w = PoolVector<int>::Write(); return sarr; }; @@ -303,12 +303,12 @@ Variant _jobject_to_variant(JNIEnv * env, jobject obj) { jbyteArray arr = (jbyteArray)obj; int fCount = env->GetArrayLength(arr); - DVector<uint8_t> sarr; + PoolVector<uint8_t> sarr; sarr.resize(fCount); - DVector<uint8_t>::Write w = sarr.write(); + PoolVector<uint8_t>::Write w = sarr.write(); env->GetByteArrayRegion(arr,0,fCount,reinterpret_cast<signed char*>(w.ptr())); - w = DVector<uint8_t>::Write(); + w = PoolVector<uint8_t>::Write(); return sarr; }; @@ -540,12 +540,12 @@ public: jintArray arr = (jintArray)env->CallObjectMethodA(instance,E->get().method,v); int fCount = env->GetArrayLength(arr); - DVector<int> sarr; + PoolVector<int> sarr; sarr.resize(fCount); - DVector<int>::Write w = sarr.write(); + PoolVector<int>::Write w = sarr.write(); env->GetIntArrayRegion(arr,0,fCount,w.ptr()); - w = DVector<int>::Write(); + w = PoolVector<int>::Write(); ret=sarr; env->DeleteLocalRef(arr); } break; @@ -554,12 +554,12 @@ public: jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance,E->get().method,v); int fCount = env->GetArrayLength(arr); - DVector<float> sarr; + PoolVector<float> sarr; sarr.resize(fCount); - DVector<float>::Write w = sarr.write(); + PoolVector<float>::Write w = sarr.write(); env->GetFloatArrayRegion(arr,0,fCount,w.ptr()); - w = DVector<float>::Write(); + w = PoolVector<float>::Write(); ret=sarr; env->DeleteLocalRef(arr); } break; diff --git a/platform/iphone/rasterizer_iphone.cpp b/platform/iphone/rasterizer_iphone.cpp index 3654f6d2d6..ee0457cfb1 100644 --- a/platform/iphone/rasterizer_iphone.cpp +++ b/platform/iphone/rasterizer_iphone.cpp @@ -286,7 +286,7 @@ void RasterizerIPhone::texture_blit_rect(RID p_texture,int p_x,int p_y, const Im GLenum blit_target = GL_TEXTURE_2D; //(texture->target == GL_TEXTURE_CUBE_MAP)?_cube_side_enum[p_cube_side]:GL_TEXTURE_2D; - DVector<uint8_t>::Read read = img.get_data().read(); + PoolVector<uint8_t>::Read read = img.get_data().read(); glBindTexture(texture->target, texture->tex_id); glTexSubImage2D( blit_target, 0, p_x,p_y,img.get_width(),img.get_height(),format,GL_UNSIGNED_BYTE,read.ptr() ); @@ -770,7 +770,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( surface->index_array_len<=0, ERR_INVALID_DATA ); ERR_FAIL_COND_V( p_array.get_type() != Variant::INT_ARRAY, ERR_INVALID_PARAMETER ); - DVector<int> indices = p_array; + PoolVector<int> indices = p_array; ERR_FAIL_COND_V( indices.size() == 0, ERR_INVALID_PARAMETER ); ERR_FAIL_COND_V( indices.size() != surface->index_array_len, ERR_INVALID_PARAMETER ); @@ -780,7 +780,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,surface->index_id); }; - DVector<int>::Read read = indices.read(); + PoolVector<int>::Read read = indices.read(); const int *src=read.ptr(); for (int i=0;i<surface->index_array_len;i++) { @@ -822,14 +822,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( p_array.get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Vector3> array = p_array; + PoolVector<Vector3> array = p_array; ERR_FAIL_COND_V( array.size() != surface->array_len, ERR_INVALID_PARAMETER ); if (surface->array_local == 0) { glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); }; - DVector<Vector3>::Read read = array.read(); + PoolVector<Vector3>::Read read = array.read(); const Vector3* src=read.ptr(); // setting vertices means regenerating the AABB @@ -868,7 +868,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( p_array.get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); - DVector<real_t> array = p_array; + PoolVector<real_t> array = p_array; ERR_FAIL_COND_V( array.size() != surface->array_len*4, ERR_INVALID_PARAMETER ); @@ -877,7 +877,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr }; - DVector<real_t>::Read read = array.read(); + PoolVector<real_t>::Read read = array.read(); const real_t* src = read.ptr(); for (int i=0;i<surface->array_len;i++) { @@ -908,7 +908,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( p_array.get_type() != Variant::COLOR_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Color> array = p_array; + PoolVector<Color> array = p_array; ERR_FAIL_COND_V( array.size() != surface->array_len, ERR_INVALID_PARAMETER ); @@ -916,7 +916,7 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); - DVector<Color>::Read read = array.read(); + PoolVector<Color>::Read read = array.read(); const Color* src = read.ptr(); surface->has_alpha_cache=false; @@ -943,14 +943,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( p_array.get_type() != Variant::VECTOR3_ARRAY, ERR_INVALID_PARAMETER ); - DVector<Vector3> array = p_array; + PoolVector<Vector3> array = p_array; ERR_FAIL_COND_V( array.size() != surface->array_len , ERR_INVALID_PARAMETER); if (surface->array_local == 0) glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); - DVector<Vector3>::Read read = array.read(); + PoolVector<Vector3>::Read read = array.read(); const Vector3 * src=read.ptr(); @@ -975,14 +975,14 @@ Error RasterizerIPhone::mesh_surface_set_array(RID p_mesh, int p_surface,VS::Arr ERR_FAIL_COND_V( p_array.get_type() != Variant::REAL_ARRAY, ERR_INVALID_PARAMETER ); - DVector<real_t> array = p_array; + PoolVector<real_t> array = p_array; ERR_FAIL_COND_V( array.size() != surface->array_len*VS::ARRAY_WEIGHTS_SIZE, ERR_INVALID_PARAMETER ); if (surface->array_local == 0) glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); - DVector<real_t>::Read read = array.read(); + PoolVector<real_t>::Read read = array.read(); const real_t * src = read.ptr(); diff --git a/platform/javascript/audio_server_javascript.cpp b/platform/javascript/audio_server_javascript.cpp index fec553df04..d1fba030a5 100644 --- a/platform/javascript/audio_server_javascript.cpp +++ b/platform/javascript/audio_server_javascript.cpp @@ -87,7 +87,7 @@ const void* AudioServerJavascript::sample_get_data_ptr(RID p_sample) const{ return NULL; } -void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer){ +void AudioServerJavascript::sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer){ Sample *sample = sample_owner.get(p_sample); ERR_FAIL_COND(!sample); @@ -95,7 +95,7 @@ void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t> Vector<float> buffer; buffer.resize(sample->length*chans); - DVector<uint8_t>::Read r=p_buffer.read(); + PoolVector<uint8_t>::Read r=p_buffer.read(); if (sample->format==SAMPLE_FORMAT_PCM8) { const int8_t*ptr = (const int8_t*)r.ptr(); for(int i=0;i<sample->length*chans;i++) { @@ -116,10 +116,10 @@ void AudioServerJavascript::sample_set_data(RID p_sample, const DVector<uint8_t> } -DVector<uint8_t> AudioServerJavascript::sample_get_data(RID p_sample) const{ +PoolVector<uint8_t> AudioServerJavascript::sample_get_data(RID p_sample) const{ - return DVector<uint8_t>(); + return PoolVector<uint8_t>(); } void AudioServerJavascript::sample_set_mix_rate(RID p_sample,int p_rate){ diff --git a/platform/javascript/audio_server_javascript.h b/platform/javascript/audio_server_javascript.h index 47aadf6bc6..8e61e94dfc 100644 --- a/platform/javascript/audio_server_javascript.h +++ b/platform/javascript/audio_server_javascript.h @@ -131,8 +131,8 @@ public: virtual const void* sample_get_data_ptr(RID p_sample) const; - virtual void sample_set_data(RID p_sample, const DVector<uint8_t>& p_buffer); - virtual DVector<uint8_t> sample_get_data(RID p_sample) const; + virtual void sample_set_data(RID p_sample, const PoolVector<uint8_t>& p_buffer); + virtual PoolVector<uint8_t> sample_get_data(RID p_sample) const; virtual void sample_set_mix_rate(RID p_sample,int p_rate); virtual int sample_get_mix_rate(RID p_sample) const; diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index f27eb98764..548d33ebfa 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1327,8 +1327,8 @@ void OS_OSX::set_icon(const Image& p_icon) { uint8_t *pixels = [imgrep bitmapData]; int len = 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(); /* Premultiply the alpha channel */ for (int i = 0; i<len ; i++) { diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 97ed8d7ae0..5beef2693f 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2126,7 +2126,7 @@ void OS_Windows::set_icon(const Image& p_icon) { encode_uint32(0,&icon_bmp[36]); uint8_t *wr=&icon_bmp[40]; - DVector<uint8_t>::Read r= icon.get_data().read(); + PoolVector<uint8_t>::Read r= icon.get_data().read(); for(int i=0;i<h;i++) { diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 74482a57e7..e560b46d4b 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1894,7 +1894,7 @@ void OS_X11::set_icon(const Image& p_icon) { pd[0]=w; pd[1]=h; - DVector<uint8_t>::Read r = img.get_data().read(); + PoolVector<uint8_t>::Read r = img.get_data().read(); long * wr = &pd[2]; uint8_t const * pr = r.ptr(); |