diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2013-04-04 18:15:00 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-05 16:26:07 +0200 |
commit | 439a6fec84a62b9d166b84dc7574ddc250a38bfb (patch) | |
tree | 8cc00b5b3ce8f2af15bc9ba96c3cdd3987e03892 /src/plugins/platforms/android/src/androidjnimain.cpp | |
parent | 722798a359761a1eb635d18547b076615f192508 (diff) |
Android: set logicalDpi based on DisplayMetrics.scaledDensity
The mathematically correct way would be to set logicalDPi to
160*scaledDensity, but then a 12 pt font would be gigantic. On
iOS, we use a factor of 72 to be compatible with the native APIs,
but that means that a 12 pt font is very small.
A factor of 100 means that desktop apps look reasonable by default.
Task-number: QTBUG-29674
Change-Id: I607f110150fb95685a6980b92f6f92f2b489f959
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/plugins/platforms/android/src/androidjnimain.cpp')
-rw-r--r-- | src/plugins/platforms/android/src/androidjnimain.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/platforms/android/src/androidjnimain.cpp b/src/plugins/platforms/android/src/androidjnimain.cpp index ae94e75e34..36d95b0816 100644 --- a/src/plugins/platforms/android/src/androidjnimain.cpp +++ b/src/plugins/platforms/android/src/androidjnimain.cpp @@ -123,6 +123,7 @@ static QAndroidPlatformIntegration *m_androidPlatformIntegration = 0; static int m_desktopWidthPixels = 0; static int m_desktopHeightPixels = 0; +static double m_scaledDensity = 0; static volatile bool m_pauseApplication; @@ -287,6 +288,11 @@ namespace QtAndroid return m_desktopHeightPixels; } + double scaledDensity() + { + return m_scaledDensity; + } + JavaVM *javaVM() { return m_javaVM; @@ -623,10 +629,11 @@ static void destroySurface(JNIEnv *env, jobject /*thiz*/) static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/, jint /*widthPixels*/, jint /*heightPixels*/, jint desktopWidthPixels, jint desktopHeightPixels, - jdouble xdpi, jdouble ydpi) + jdouble xdpi, jdouble ydpi, jdouble scaledDensity) { m_desktopWidthPixels = desktopWidthPixels; m_desktopHeightPixels = desktopHeightPixels; + m_scaledDensity = scaledDensity; if (!m_androidPlatformIntegration) { QAndroidPlatformIntegration::setDefaultDisplayMetrics(desktopWidthPixels,desktopHeightPixels, @@ -687,7 +694,7 @@ static JNINativeMethod methods[] = { {"resumeQtApp", "()V", (void *)resumeQtApp}, {"quitQtAndroidPlugin", "()V", (void *)quitQtAndroidPlugin}, {"terminateQt", "()V", (void *)terminateQt}, - {"setDisplayMetrics", "(IIIIDD)V", (void *)setDisplayMetrics}, + {"setDisplayMetrics", "(IIIIDDD)V", (void *)setDisplayMetrics}, {"setSurface", "(Ljava/lang/Object;)V", (void *)setSurface}, {"destroySurface", "()V", (void *)destroySurface}, {"lockSurface", "()V", (void *)lockSurface}, |