diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-07-31 16:37:34 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-08-01 10:54:39 -0700 |
commit | 908aecc3a63c5520d5b11da14a9383f885b7d126 (patch) | |
tree | 11806df7f127ea695474ae7ab490a95c19965508 /services/jni | |
parent | b1980049855fd6c53e109b44ff012a053f9436f7 (diff) | |
download | frameworks_base-908aecc3a63c5520d5b11da14a9383f885b7d126.zip frameworks_base-908aecc3a63c5520d5b11da14a9383f885b7d126.tar.gz frameworks_base-908aecc3a63c5520d5b11da14a9383f885b7d126.tar.bz2 |
Start moving away from DisplayMetrics.DENSITY_DEVICE.
This puts in most of the infrastructure needed to allow us to
switch between different densities at run time. The main remaining
uses of the global are to initialize the Bitmap object (not sure
what to do about that since it doesn't have anything passed in
the constructor to get this information from), and being able to
load drawables if we need a different density than what was preloaded
by zygote.
Change-Id: Ifdbfd6b7a5c59e6aa22e63b95b78d96af3d96848
Diffstat (limited to 'services/jni')
-rw-r--r-- | services/jni/com_android_server_display_SurfaceFlingerDisplayAdapter.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/services/jni/com_android_server_display_SurfaceFlingerDisplayAdapter.cpp b/services/jni/com_android_server_display_SurfaceFlingerDisplayAdapter.cpp index e636eed..05a74d3 100644 --- a/services/jni/com_android_server_display_SurfaceFlingerDisplayAdapter.cpp +++ b/services/jni/com_android_server_display_SurfaceFlingerDisplayAdapter.cpp @@ -31,7 +31,7 @@ static struct { jfieldID width; jfieldID height; jfieldID refreshRate; - jfieldID density; + jfieldID densityDpi; jfieldID xDpi; jfieldID yDpi; } gDisplayDeviceInfoClassInfo; @@ -49,7 +49,8 @@ static void nativeGetDefaultDisplayDeviceInfo(JNIEnv* env, jclass clazz, jobject env->SetIntField(infoObj, gDisplayDeviceInfoClassInfo.width, info.w); env->SetIntField(infoObj, gDisplayDeviceInfoClassInfo.height, info.h); env->SetFloatField(infoObj, gDisplayDeviceInfoClassInfo.refreshRate, info.fps); - env->SetFloatField(infoObj, gDisplayDeviceInfoClassInfo.density, info.density); + env->SetIntField(infoObj, gDisplayDeviceInfoClassInfo.densityDpi, + (jint)((info.density*160) + .5f)); env->SetFloatField(infoObj, gDisplayDeviceInfoClassInfo.xDpi, info.xdpi); env->SetFloatField(infoObj, gDisplayDeviceInfoClassInfo.yDpi, info.ydpi); } @@ -81,7 +82,7 @@ int register_android_server_display_SurfaceFlingerDisplayAdapter(JNIEnv* env) { GET_FIELD_ID(gDisplayDeviceInfoClassInfo.width, clazz, "width", "I"); GET_FIELD_ID(gDisplayDeviceInfoClassInfo.height, clazz, "height", "I"); GET_FIELD_ID(gDisplayDeviceInfoClassInfo.refreshRate, clazz, "refreshRate", "F"); - GET_FIELD_ID(gDisplayDeviceInfoClassInfo.density, clazz, "density", "F"); + GET_FIELD_ID(gDisplayDeviceInfoClassInfo.densityDpi, clazz, "densityDpi", "I"); GET_FIELD_ID(gDisplayDeviceInfoClassInfo.xDpi, clazz, "xDpi", "F"); GET_FIELD_ID(gDisplayDeviceInfoClassInfo.yDpi, clazz, "yDpi", "F"); return 0; |