summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
author Chia-I Wu <olv@google.com> 2018-08-24 15:34:02 -0700
committer Chia-I Wu <olv@google.com> 2018-08-27 11:20:19 -0700
commitc80dcbb574106f3ff126d6b77cbcd12463089301 (patch)
tree7ed849fd2953b83115f23a32491f4f39f5078e5d /services/surfaceflinger/SurfaceFlinger.cpp
parent9d1abea931aaacf2354cc49b3d9a484de2693e93 (diff)
surfaceflinger: remove ISurfaceComposer.h from RenderArea
RenderArea can be made more generic by removing ISurfaceComposer.h dependency. The caller also prefers to work with ui::Transform::orientation_flags than ISurfaceComposer::Rotation (we want to move updateDimensions to the caller). Bug: 113041375 Test: take screenshot, rotate screen, screencap Change-Id: I16e1392d5c92c2f423f98307e867918415404d26
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index d4f384f934..2dc55c637f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -143,6 +143,21 @@ bool isWideColorMode(const ColorMode colorMode) {
return false;
}
+ui::Transform::orientation_flags fromSurfaceComposerRotation(ISurfaceComposer::Rotation rotation) {
+ switch (rotation) {
+ case ISurfaceComposer::eRotateNone:
+ return ui::Transform::ROT_0;
+ case ISurfaceComposer::eRotate90:
+ return ui::Transform::ROT_90;
+ case ISurfaceComposer::eRotate180:
+ return ui::Transform::ROT_180;
+ case ISurfaceComposer::eRotate270:
+ return ui::Transform::ROT_270;
+ }
+ ALOGE("Invalid rotation passed to captureScreen(): %d\n", rotation);
+ return ui::Transform::ROT_0;
+}
+
#pragma clang diagnostic pop
class ConditionalLock {
@@ -4902,6 +4917,8 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& displayToken,
if (!displayToken) return BAD_VALUE;
+ auto renderAreaRotation = fromSurfaceComposerRotation(rotation);
+
const auto display = getDisplayDeviceLocked(displayToken);
if (!display) return BAD_VALUE;
@@ -4915,7 +4932,7 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& displayToken,
}
}
- DisplayRenderArea renderArea(display, sourceCrop, reqWidth, reqHeight, rotation);
+ DisplayRenderArea renderArea(display, sourceCrop, reqWidth, reqHeight, renderAreaRotation);
auto traverseLayers = std::bind(std::mem_fn(&SurfaceFlinger::traverseLayersInDisplay), this,
display, minLayerZ, maxLayerZ, std::placeholders::_1);