From 9266c558bf1d21ff647525ff99f7dadbca417309 Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Thu, 15 Jan 2009 16:12:10 -0800 Subject: auto import from //branches/cupcake/...@126645 --- libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp') diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp index 19e32ec..92588fa 100644 --- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp +++ b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -193,11 +195,14 @@ void DisplayHardware::init(uint32_t dpy) } mRefreshRate = 60.f; // TODO: get the real refresh rate - // compute a "density" automatically as a scale factor from 160 dpi - // TODO: this value should be calculated a compile time based on the - // board. - mDensity = floorf((mDpiX>mDpiY ? mDpiX : mDpiY)*0.1f + 0.5f) * (10.0f/160.0f); - LOGI("density = %f", mDensity); + + char property[PROPERTY_VALUE_MAX]; + if (property_get("ro.sf.lcd_density", property, NULL) <= 0) { + LOGW("ro.sf.lcd_density not defined, using 160 dpi by default."); + strcpy(property, "160"); + } + mDensity = atoi(property) * (1.0f/160.0f); + /* * Create our OpenGL ES context -- cgit v1.1