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 /platform/android | |
parent | fb8c93c10b4b73d5f18f1ed287497728800e22b5 (diff) |
PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
Diffstat (limited to 'platform/android')
-rw-r--r-- | platform/android/api/java_class_wrapper.h | 16 | ||||
-rw-r--r-- | platform/android/export/export.cpp | 8 | ||||
-rw-r--r-- | platform/android/java_godot_lib_jni.cpp | 64 |
3 files changed, 44 insertions, 44 deletions
diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h index 6c06d57ac1..2b13be2de4 100644 --- a/platform/android/api/java_class_wrapper.h +++ b/platform/android/api/java_class_wrapper.h @@ -126,34 +126,34 @@ class JavaClass : public Reference { case ARG_ARRAY_BIT | ARG_TYPE_VOID: r_type = Variant::NIL; break; case ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN: r_type = Variant::ARRAY; break; case ARG_ARRAY_BIT | ARG_TYPE_BYTE: - r_type = Variant::POOL_BYTE_ARRAY; + r_type = Variant::PACKED_BYTE_ARRAY; likelihood = 1.0; break; case ARG_ARRAY_BIT | ARG_TYPE_CHAR: - r_type = Variant::POOL_BYTE_ARRAY; + r_type = Variant::PACKED_BYTE_ARRAY; likelihood = 0.5; break; case ARG_ARRAY_BIT | ARG_TYPE_SHORT: - r_type = Variant::POOL_INT_ARRAY; + r_type = Variant::PACKED_INT_ARRAY; likelihood = 0.3; break; case ARG_ARRAY_BIT | ARG_TYPE_INT: - r_type = Variant::POOL_INT_ARRAY; + r_type = Variant::PACKED_INT_ARRAY; likelihood = 1.0; break; case ARG_ARRAY_BIT | ARG_TYPE_LONG: - r_type = Variant::POOL_INT_ARRAY; + r_type = Variant::PACKED_INT_ARRAY; likelihood = 0.5; break; case ARG_ARRAY_BIT | ARG_TYPE_FLOAT: - r_type = Variant::POOL_REAL_ARRAY; + r_type = Variant::PACKED_REAL_ARRAY; likelihood = 1.0; break; case ARG_ARRAY_BIT | ARG_TYPE_DOUBLE: - r_type = Variant::POOL_REAL_ARRAY; + r_type = Variant::PACKED_REAL_ARRAY; likelihood = 0.5; break; - case ARG_ARRAY_BIT | ARG_TYPE_STRING: r_type = Variant::POOL_STRING_ARRAY; break; + case ARG_ARRAY_BIT | ARG_TYPE_STRING: r_type = Variant::PACKED_STRING_ARRAY; break; case ARG_ARRAY_BIT | ARG_TYPE_CLASS: r_type = Variant::ARRAY; break; } } diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 952bc3d28f..2679d9db92 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -701,7 +701,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { aperms++; } - PoolStringArray user_perms = p_preset->get("permissions/custom_permissions"); + PackedStringArray user_perms = p_preset->get("permissions/custom_permissions"); for (int i = 0; i < user_perms.size(); i++) { String user_perm = user_perms[i].strip_edges(); @@ -1310,11 +1310,11 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { working_image->resize(p_icon.dimensions, p_icon.dimensions, Image::Interpolation::INTERPOLATE_LANCZOS); } - PoolVector<uint8_t> png_buffer; + Vector<uint8_t> png_buffer; Error err = PNGDriverCommon::image_to_png(working_image, png_buffer); if (err == OK) { p_data.resize(png_buffer.size()); - memcpy(p_data.ptrw(), png_buffer.read().ptr(), p_data.size()); + memcpy(p_data.ptrw(), png_buffer.ptr(), p_data.size()); } else { String err_str = String("Failed to convert resized icon (") + p_processing_file_name + ") to png."; WARN_PRINT(err_str.utf8().get_data()); @@ -1398,7 +1398,7 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "architectures/" + abi), is_default)); } - r_options->push_back(ExportOption(PropertyInfo(Variant::POOL_STRING_ARRAY, "permissions/custom_permissions"), PoolStringArray())); + r_options->push_back(ExportOption(PropertyInfo(Variant::PACKED_STRING_ARRAY, "permissions/custom_permissions"), PackedStringArray())); const char **perms = android_perms; while (*perms) { diff --git a/platform/android/java_godot_lib_jni.cpp b/platform/android/java_godot_lib_jni.cpp index dedb2ee114..d3d8304faf 100644 --- a/platform/android/java_godot_lib_jni.cpp +++ b/platform/android/java_godot_lib_jni.cpp @@ -123,9 +123,9 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a v.val.l = jStr; v.obj = jStr; } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { - PoolVector<String> sarray = *p_arg; + Vector<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++) { @@ -182,30 +182,30 @@ jvalret _variant_to_jvalue(JNIEnv *env, Variant::Type p_type, const Variant *p_a v.obj = jdict; } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { - PoolVector<int> array = *p_arg; + Vector<int> array = *p_arg; jintArray arr = env->NewIntArray(array.size()); - PoolVector<int>::Read r = array.read(); + const int *r = array.ptr(); env->SetIntArrayRegion(arr, 0, array.size(), r.ptr()); v.val.l = arr; v.obj = arr; } break; - case Variant::POOL_BYTE_ARRAY: { - PoolVector<uint8_t> array = *p_arg; + case Variant::PACKED_BYTE_ARRAY: { + Vector<uint8_t> array = *p_arg; jbyteArray arr = env->NewByteArray(array.size()); - PoolVector<uint8_t>::Read r = array.read(); + const uint8_t *r = array.ptr(); env->SetByteArrayRegion(arr, 0, array.size(), reinterpret_cast<const signed char *>(r.ptr())); v.val.l = arr; v.obj = arr; } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { - PoolVector<float> array = *p_arg; + Vector<float> array = *p_arg; jfloatArray arr = env->NewFloatArray(array.size()); - PoolVector<float>::Read r = array.read(); + const float *r = array.ptr(); env->SetFloatArrayRegion(arr, 0, array.size(), r.ptr()); v.val.l = arr; v.obj = arr; @@ -255,7 +255,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jobjectArray arr = (jobjectArray)obj; int stringCount = env->GetArrayLength(arr); - PoolVector<String> sarr; + Vector<String> sarr; for (int i = 0; i < stringCount; i++) { jstring string = (jstring)env->GetObjectArrayElement(arr, i); @@ -285,10 +285,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jintArray arr = (jintArray)obj; int fCount = env->GetArrayLength(arr); - PoolVector<int> sarr; + Vector<int> sarr; sarr.resize(fCount); - PoolVector<int>::Write w = sarr.write(); + int *w = sarr.ptrw(); env->GetIntArrayRegion(arr, 0, fCount, w.ptr()); w.release(); return sarr; @@ -298,10 +298,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jbyteArray arr = (jbyteArray)obj; int fCount = env->GetArrayLength(arr); - PoolVector<uint8_t> sarr; + Vector<uint8_t> sarr; sarr.resize(fCount); - PoolVector<uint8_t>::Write w = sarr.write(); + uint8_t *w = sarr.ptrw(); env->GetByteArrayRegion(arr, 0, fCount, reinterpret_cast<signed char *>(w.ptr())); w.release(); return sarr; @@ -319,10 +319,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jdoubleArray arr = (jdoubleArray)obj; int fCount = env->GetArrayLength(arr); - PoolRealArray sarr; + PackedRealArray sarr; sarr.resize(fCount); - PoolRealArray::Write w = sarr.write(); + real_t *w = sarr.ptrw(); for (int i = 0; i < fCount; i++) { @@ -337,10 +337,10 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jfloatArray arr = (jfloatArray)obj; int fCount = env->GetArrayLength(arr); - PoolRealArray sarr; + PackedRealArray sarr; sarr.resize(fCount); - PoolRealArray::Write w = sarr.write(); + real_t *w = sarr.ptrw(); for (int i = 0; i < fCount; i++) { @@ -374,7 +374,7 @@ Variant _jobject_to_variant(JNIEnv *env, jobject obj) { jmethodID get_keys = env->GetMethodID(oclass, "get_keys", "()[Ljava/lang/String;"); jobjectArray arr = (jobjectArray)env->CallObjectMethod(obj, get_keys); - PoolStringArray keys = _jobject_to_variant(env, arr); + PackedStringArray keys = _jobject_to_variant(env, arr); env->DeleteLocalRef(arr); jmethodID get_values = env->GetMethodID(oclass, "get_values", "()[Ljava/lang/Object;"); @@ -497,7 +497,7 @@ public: ret = jstring_to_string((jstring)o, env); env->DeleteLocalRef(o); } break; - case Variant::POOL_STRING_ARRAY: { + case Variant::PACKED_STRING_ARRAY: { jobjectArray arr = (jobjectArray)env->CallObjectMethodA(instance, E->get().method, v); @@ -505,29 +505,29 @@ public: env->DeleteLocalRef(arr); } break; - case Variant::POOL_INT_ARRAY: { + case Variant::PACKED_INT_ARRAY: { jintArray arr = (jintArray)env->CallObjectMethodA(instance, E->get().method, v); int fCount = env->GetArrayLength(arr); - PoolVector<int> sarr; + Vector<int> sarr; sarr.resize(fCount); - PoolVector<int>::Write w = sarr.write(); + int *w = sarr.ptrw(); env->GetIntArrayRegion(arr, 0, fCount, w.ptr()); w.release(); ret = sarr; env->DeleteLocalRef(arr); } break; - case Variant::POOL_REAL_ARRAY: { + case Variant::PACKED_REAL_ARRAY: { jfloatArray arr = (jfloatArray)env->CallObjectMethodA(instance, E->get().method, v); int fCount = env->GetArrayLength(arr); - PoolVector<float> sarr; + Vector<float> sarr; sarr.resize(fCount); - PoolVector<float>::Write w = sarr.write(); + float *w = sarr.ptrw(); env->GetFloatArrayRegion(arr, 0, fCount, w.ptr()); w.release(); ret = sarr; @@ -1249,10 +1249,10 @@ static Variant::Type get_jni_type(const String &p_type) { { "float", Variant::REAL }, { "double", Variant::REAL }, { "java.lang.String", Variant::STRING }, - { "[I", Variant::POOL_INT_ARRAY }, - { "[B", Variant::POOL_BYTE_ARRAY }, - { "[F", Variant::POOL_REAL_ARRAY }, - { "[Ljava.lang.String;", Variant::POOL_STRING_ARRAY }, + { "[I", Variant::PACKED_INT_ARRAY }, + { "[B", Variant::PACKED_BYTE_ARRAY }, + { "[F", Variant::PACKED_REAL_ARRAY }, + { "[Ljava.lang.String;", Variant::PACKED_STRING_ARRAY }, { "org.godotengine.godot.Dictionary", Variant::DICTIONARY }, { NULL, Variant::NIL } }; |