aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android/jni.cpp
diff options
context:
space:
mode:
authordhewg2011-03-13 22:31:28 +0100
committerdhewg2011-03-13 23:30:16 +0100
commit79d991081dbeaddd0294c6bbf01675d1ec1fbb72 (patch)
treee7c712df278ba9b984f460842fb0f9d0234e83ba /backends/platform/android/jni.cpp
parent4267011e3a42b3f633f86e3df6af12c456aa0f60 (diff)
downloadscummvm-rg350-79d991081dbeaddd0294c6bbf01675d1ec1fbb72.tar.gz
scummvm-rg350-79d991081dbeaddd0294c6bbf01675d1ec1fbb72.tar.bz2
scummvm-rg350-79d991081dbeaddd0294c6bbf01675d1ec1fbb72.zip
ANDROID: Add support for video feature flags
kFeatureFullscreenMode and kFeatureAspectRatioCorrection are supported now. The former prevents scaling to the full display - it scales one axis and keeps the game AR.
Diffstat (limited to 'backends/platform/android/jni.cpp')
-rw-r--r--backends/platform/android/jni.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/backends/platform/android/jni.cpp b/backends/platform/android/jni.cpp
index 6bfe9c2095..0628d92a2f 100644
--- a/backends/platform/android/jni.cpp
+++ b/backends/platform/android/jni.cpp
@@ -65,6 +65,7 @@ jfieldID JNI::_FID_Event_mouse_x = 0;
jfieldID JNI::_FID_Event_mouse_y = 0;
jfieldID JNI::_FID_Event_mouse_relative = 0;
+jmethodID JNI::_MID_getDPI = 0;
jmethodID JNI::_MID_displayMessageOnOSD = 0;
jmethodID JNI::_MID_setWindowCaption = 0;
jmethodID JNI::_MID_showVirtualKeyboard = 0;
@@ -214,6 +215,35 @@ void JNI::throwRuntimeException(JNIEnv *env, const char *msg) {
// calls to the dark side
+void JNI::getDPI(float *values) {
+ values[0] = 0.0;
+ values[1] = 0.0;
+
+ JNIEnv *env = JNI::getEnv();
+
+ jfloatArray array = env->NewFloatArray(2);
+
+ env->CallVoidMethod(_jobj, _MID_getDPI, array);
+
+ if (env->ExceptionCheck()) {
+ LOGE("Failed to get DPIs");
+
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+ } else {
+ jfloat *res = env->GetFloatArrayElements(array, 0);
+
+ if (res) {
+ values[0] = res[0];
+ values[1] = res[1];
+
+ env->ReleaseFloatArrayElements(array, res, 0);
+ }
+ }
+
+ env->DeleteLocalRef(array);
+}
+
void JNI::displayMessageOnOSD(const char *msg) {
JNIEnv *env = JNI::getEnv();
jstring java_msg = env->NewStringUTF(msg);
@@ -445,6 +475,7 @@ void JNI::create(JNIEnv *env, jobject self, jobject asset_manager,
} while (0)
FIND_METHOD(, setWindowCaption, "(Ljava/lang/String;)V");
+ FIND_METHOD(, getDPI, "([F)V");
FIND_METHOD(, displayMessageOnOSD, "(Ljava/lang/String;)V");
FIND_METHOD(, showVirtualKeyboard, "(Z)V");
FIND_METHOD(, getSysArchives, "()[Ljava/lang/String;");