diff options
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 63f94c6df..d75774686 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -100,20 +100,6 @@ extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name); -static int convertRotation(android::Transform::orientation_flags rotation) -{ - switch (rotation) { - case android::Transform::ROT_90: - return 1; - case android::Transform::ROT_180: - return 2; - case android::Transform::ROT_270: - return 3; - default: - return 0; - } -} - namespace android { using namespace android::hardware::configstore; @@ -258,10 +244,6 @@ SurfaceFlinger::SurfaceFlinger() mLayerTripleBufferingDisabled = atoi(value); ALOGI_IF(mLayerTripleBufferingDisabled, "Disabling Triple Buffering"); - // we store the value as orientation: - // 90 -> 1, 180 -> 2, 270 -> 3 - mHardwareRotation = property_get_int32("ro.sf.hwrotation", 0) / 90; - // We should be reading 'persist.sys.sf.color_saturation' here // but since /data may be encrypted, we need to wait until after vold // comes online to attempt to read the property. The property is @@ -813,8 +795,10 @@ status_t SurfaceFlinger::getDisplayConfigs(const sp<IBinder>& display, info.orientation = 0; } - if ((type == DisplayDevice::DISPLAY_PRIMARY) && - (mHardwareRotation & DisplayState::eOrientationSwapMask)) { + char value[PROPERTY_VALUE_MAX]; + property_get("ro.sf.hwrotation", value, "0"); + int additionalRot = atoi(value) / 90; + if ((type == DisplayDevice::DISPLAY_PRIMARY) && (additionalRot & DisplayState::eOrientationSwapMask)) { info.h = hwConfig->getWidth(); info.w = hwConfig->getHeight(); info.xdpi = ydpi; @@ -4180,27 +4164,14 @@ void SurfaceFlinger::repaintEverything() { // Checks that the requested width and height are valid and updates them to the display dimensions // if they are set to 0 static status_t updateDimensionsLocked(const sp<const DisplayDevice>& displayDevice, - Transform::orientation_flags* rotation, - int32_t hardwareRotation, + Transform::orientation_flags rotation, uint32_t* requestedWidth, uint32_t* requestedHeight) { // get screen geometry uint32_t displayWidth = displayDevice->getWidth(); uint32_t displayHeight = displayDevice->getHeight(); - switch ((convertRotation(*rotation) + hardwareRotation) % 4) { - case 1: - std::swap(displayWidth, displayHeight); - *rotation = Transform::ROT_90; - break; - case 2: - *rotation = Transform::ROT_180; - break; - case 3: - std::swap(displayWidth, displayHeight); - *rotation = Transform::ROT_270; - break; - default: - break; + if (rotation & Transform::ROT_90) { + std::swap(displayWidth, displayHeight); } if ((*requestedWidth > displayWidth) || (*requestedHeight > displayHeight)) { @@ -4308,8 +4279,7 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& display, { // Autolock scope Mutex::Autolock lock(mStateLock); sp<const DisplayDevice> displayDevice(getDisplayDeviceLocked(display)); - updateDimensionsLocked(displayDevice, &rotationFlags, mHardwareRotation, - &reqWidth, &reqHeight); + updateDimensionsLocked(displayDevice, rotationFlags, &reqWidth, &reqHeight); } // create a surface (because we're a producer, and we need to |