Add final crop implementation
Bug 26559810
Change-Id: Idaccd13cd625c92d18665ddecebdbb266ea365f3
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 3242f55..04b5446 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -156,6 +156,8 @@
status_t setOrientation(int orientation);
status_t setCrop(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
const Rect& crop);
+ status_t setFinalCrop(const sp<SurfaceComposerClient>& client,
+ const sp<IBinder>& id, const Rect& crop);
status_t setLayerStack(const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id, uint32_t layerStack);
status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client,
@@ -386,6 +388,18 @@
return NO_ERROR;
}
+status_t Composer::setFinalCrop(const sp<SurfaceComposerClient>& client,
+ const sp<IBinder>& id, const Rect& crop) {
+ Mutex::Autolock _l(mLock);
+ layer_state_t* s = getLayerStateLocked(client, id);
+ if (!s) {
+ return BAD_INDEX;
+ }
+ s->what |= layer_state_t::eFinalCropChanged;
+ s->finalCrop = crop;
+ return NO_ERROR;
+}
+
status_t Composer::deferTransactionUntil(
const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
const sp<IBinder>& handle, uint64_t frameNumber) {
@@ -579,6 +593,11 @@
return getComposer().setCrop(this, id, crop);
}
+status_t SurfaceComposerClient::setFinalCrop(const sp<IBinder>& id,
+ const Rect& crop) {
+ return getComposer().setFinalCrop(this, id, crop);
+}
+
status_t SurfaceComposerClient::setPosition(const sp<IBinder>& id, float x, float y) {
return getComposer().setPosition(this, id, x, y);
}