Bug 894683 - Fix dpi reporting on gonk-jb, r=vlad
authorMichael Wu <mwu@mozilla.com>
Tue, 16 Jul 2013 20:57:41 -0400
changeset 138763 97222fa195733655fbd8381564f8e9e2352a58f9
parent 138762 1c2f163cbebc4339747c45704d8e69a55e257655
child 138764 4318efa48e8d79418b34376c1dea5981a942deda
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersvlad
bugs894683
milestone25.0a1
Bug 894683 - Fix dpi reporting on gonk-jb, r=vlad
widget/gonk/libdisplay/GonkDisplay.h
widget/gonk/libdisplay/GonkDisplayJB.cpp
--- a/widget/gonk/libdisplay/GonkDisplay.h
+++ b/widget/gonk/libdisplay/GonkDisplay.h
@@ -36,17 +36,17 @@ public:
     virtual void* GetHWCDevice() = 0;
 
     virtual bool SwapBuffers(EGLDisplay dpy, EGLSurface sur) = 0;
 
     virtual ANativeWindowBuffer* DequeueBuffer() = 0;
 
     virtual bool QueueBuffer(ANativeWindowBuffer* buf) = 0;
 
-    uint32_t xdpi;
+    float xdpi;
     uint32_t surfaceformat;
 };
 
 __attribute__ ((weak))
 GonkDisplay* GetGonkDisplay();
 
 }
 #endif /* GONKDISPLAY_H */
--- a/widget/gonk/libdisplay/GonkDisplayJB.cpp
+++ b/widget/gonk/libdisplay/GonkDisplayJB.cpp
@@ -81,17 +81,17 @@ GonkDisplayJB::GonkDisplayJB()
             HWC_DISPLAY_HEIGHT,
             HWC_DISPLAY_DPI_X,
             HWC_DISPLAY_NO_ATTRIBUTE
         };
         mHwc->getDisplayAttributes(mHwc, 0, 0, attrs, values);
 
         mWidth = values[0];
         mHeight = values[1];
-        xdpi = values[2];
+        xdpi = values[2] / 1000.0f;
         surfaceformat = HAL_PIXEL_FORMAT_RGBA_8888;
     }
 
     err = hw_get_module(POWER_HARDWARE_MODULE_ID,
                                            (hw_module_t const**)&mPowerModule);
     if (!err)
         mPowerModule->init(mPowerModule);
     ALOGW_IF(err, "Couldn't load %s module (%s)", POWER_HARDWARE_MODULE_ID, strerror(-err));