MCPcopy Create free account
hub / github.com/SatDump/SatDump / funcDeviceScale

Function funcDeviceScale

android/backend.cpp:8–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6extern EGLSurface g_EglSurface;
7
8float funcDeviceScale()
9{
10 JavaVM* java_vm = g_App->activity->vm;
11 JNIEnv* java_env = NULL;
12
13 jint jni_return = java_vm->GetEnv((void**)&java_env, JNI_VERSION_1_6);
14 if (jni_return == JNI_ERR)
15 throw satdump_exception("Could not get JNI environement");
16
17 jni_return = java_vm->AttachCurrentThread(&java_env, NULL);
18 if (jni_return != JNI_OK)
19 throw satdump_exception("Could not attach to thread");
20
21 jclass native_activity_clazz = java_env->GetObjectClass(g_App->activity->clazz);
22 if (native_activity_clazz == NULL)
23 throw satdump_exception("Could not get MainActivity class");
24
25 jmethodID method_id = java_env->GetMethodID(native_activity_clazz, "get_dpi", "()F");
26 if (method_id == NULL)
27 throw satdump_exception("Could not get methode ID");
28
29 jfloat jflt = java_env->CallFloatMethod(g_App->activity->clazz, method_id);
30
31 jni_return = java_vm->DetachCurrentThread();
32 if (jni_return != JNI_OK)
33 throw satdump_exception("Could not detach from thread");
34
35 return jflt;
36}
37
38void funcRebuildFonts()
39{

Callers 1

bindBackendFunctionsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected