From d15ef27f9b13727fa7358e3c09572f66bb1e0668 Mon Sep 17 00:00:00 2001 From: Riley Andrews Date: Thu, 4 Sep 2014 16:19:44 -0700 Subject: [PATCH] Update ScreenshotClient to take advantage of rotation in surfaceflinger's screencap api Change-Id: I836649d9d5cd5958ce34e47f26f4a36d2d05d24c --- include/gui/SurfaceComposerClient.h | 4 ++++ libs/gui/SurfaceComposerClient.cpp | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h index c73ef701a..4cbfc0995 100644 --- a/include/gui/SurfaceComposerClient.h +++ b/include/gui/SurfaceComposerClient.h @@ -209,6 +209,10 @@ public: Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, uint32_t minLayerZ, uint32_t maxLayerZ, bool useIdentityTransform); + status_t update(const sp& display, + Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, + uint32_t minLayerZ, uint32_t maxLayerZ, + bool useIdentityTransform, uint32_t rotation); sp getCpuConsumer() const; diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 6e13207a8..6446926ea 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -717,7 +717,7 @@ sp ScreenshotClient::getCpuConsumer() const { status_t ScreenshotClient::update(const sp& display, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform) { + bool useIdentityTransform, uint32_t rotation) { sp s(ComposerService::getComposerService()); if (s == NULL) return NO_INIT; sp cpuConsumer = getCpuConsumer(); @@ -729,7 +729,8 @@ status_t ScreenshotClient::update(const sp& display, } status_t err = s->captureScreen(display, mProducer, sourceCrop, - reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform); + reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, + static_cast(rotation)); if (err == NO_ERROR) { err = mCpuConsumer->lockNextBuffer(&mBuffer); @@ -740,16 +741,25 @@ status_t ScreenshotClient::update(const sp& display, return err; } +status_t ScreenshotClient::update(const sp& display, + Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, + uint32_t minLayerZ, uint32_t maxLayerZ, + bool useIdentityTransform) { + + return ScreenshotClient::update(display, sourceCrop, reqWidth, reqHeight, + minLayerZ, maxLayerZ, useIdentityTransform, ISurfaceComposer::eRotateNone); +} + status_t ScreenshotClient::update(const sp& display, Rect sourceCrop, bool useIdentityTransform) { return ScreenshotClient::update(display, sourceCrop, 0, 0, 0, -1UL, - useIdentityTransform); + useIdentityTransform, ISurfaceComposer::eRotateNone); } status_t ScreenshotClient::update(const sp& display, Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, bool useIdentityTransform) { return ScreenshotClient::update(display, sourceCrop, reqWidth, reqHeight, - 0, -1UL, useIdentityTransform); + 0, -1UL, useIdentityTransform, ISurfaceComposer::eRotateNone); } void ScreenshotClient::release() {