summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2015-06-09 16:44:40 -0700
committerDan Stoza <stoza@google.com>2015-06-10 10:33:21 -0700
commit65dc7eeff096c3b909d7932c8a94e61c31f76831 (patch)
tree5d9e0f184898f6daa1b1d54987ad31bcab16e976 /services
parent5ab3ba1e43e609c7a77cc780c888f666d153a4c9 (diff)
downloadframeworks_native-65dc7eeff096c3b909d7932c8a94e61c31f76831.zip
frameworks_native-65dc7eeff096c3b909d7932c8a94e61c31f76831.tar.gz
frameworks_native-65dc7eeff096c3b909d7932c8a94e61c31f76831.tar.bz2
SF: Swap w/h when capturing rotated screenshots
Swaps width and height when capturing a screenshot that is rotated by 90 or 270 degrees. Bug: 8433742 Change-Id: Ibf0b604f541e3cc271e56fe0ad04dc366beb5d79 (cherry picked from commit 3502416204d9dbd905012ee586d8bd145323809f)
Diffstat (limited to 'services')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 4f19646..2e6d2b6 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3266,8 +3266,12 @@ status_t SurfaceFlinger::captureScreenImplLocked(
ATRACE_CALL();
// get screen geometry
- const uint32_t hw_w = hw->getWidth();
- const uint32_t hw_h = hw->getHeight();
+ uint32_t hw_w = hw->getWidth();
+ uint32_t hw_h = hw->getHeight();
+
+ if (rotation & Transform::ROT_90) {
+ std::swap(hw_w, hw_h);
+ }
if ((reqWidth > hw_w) || (reqHeight > hw_h)) {
ALOGE("size mismatch (%d, %d) > (%d, %d)",