public:
static float getEmuDensity() {
return getDensityFromProperty("qemu.sf.lcd_density"); }
- static float getBuildDensity(const DisplayInfo& info) {
+ static float getBuildDensity(const sp<const DisplayDevice>& hw) {
static float density = getDensityFromProperty("ro.sf.lcd_density");
#if defined(__i386__) || defined(__x86_64__)
- if (density == 0.0f) {
- uint32_t area = info.w * info.h;
+ if (density == 0.0f && hw) {
+ uint32_t area = hw->getWidth() * hw->getHeight();
if (area <= 800 * 480) {
density = 120.0f;
} else if (area <= 1024 * 600) {
} else {
density = 320.0f;
}
- ALOGI("auto set density to %f", density);
+ ALOGI("auto set density to %f for primary display %d x %d", density, hw->getWidth(), hw->getHeight());
}
#endif
return density;
float ydpi = hwConfig->getDpiY();
info.w = hwConfig->getWidth();
info.h = hwConfig->getHeight();
-
- info.w = hwConfig->getWidth();
- info.h = hwConfig->getHeight();
// Default display viewport to display width and height
info.viewportW = info.w;
info.viewportH = info.h;
if (displayId == getInternalDisplayIdLocked()) {
+ const auto display = getDefaultDisplayDeviceLocked();
// The density of the device is provided by a build property
- float density = Density::getBuildDensity(info) / 160.0f;
+ float density = Density::getBuildDensity(display) / 160.0f;
if (density == 0) {
// the build doesn't provide a density -- this is wrong!
// use xdpi instead
info.density = density;
// TODO: this needs to go away (currently needed only by webkit)
- const auto display = getDefaultDisplayDeviceLocked();
info.orientation = display ? display->getOrientation() : 0;
// This is for screenrecord