summaryrefslogtreecommitdiffstats
path: root/libs/gui/SurfaceComposerClient.cpp
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2012-05-10 20:43:55 -0700
committerJamie Gennis <jgennis@google.com>2012-05-11 03:16:02 -0700
commitf15a83f5814219c167f87cb8aaea622fc8493499 (patch)
tree131d3c92aa0f1e75b110b187b8ee6859be5d0bc5 /libs/gui/SurfaceComposerClient.cpp
parentf30fd01497a53cbff8692721026c3f7b6830158e (diff)
downloadframeworks_native-f15a83f5814219c167f87cb8aaea622fc8493499.zip
frameworks_native-f15a83f5814219c167f87cb8aaea622fc8493499.tar.gz
frameworks_native-f15a83f5814219c167f87cb8aaea622fc8493499.tar.bz2
SurfaceFlinger: add a crop to the layer state
This change adds a crop rectangle specified in window coordinates to the layer state. The all window pixels outside this crop rectangle are treated as though they were fully transparent. This change also adds the plumbing necessary for WindowManager to set that crop. Change-Id: I582bc445dc8c97d4c943d4db8d582a6ef5a66081
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
-rw-r--r--libs/gui/SurfaceComposerClient.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index ceb1ba6..8fa2167 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -125,6 +125,8 @@ public:
const sp<SurfaceComposerClient>& client, SurfaceID id,
uint32_t tint);
status_t setOrientation(int orientation);
+ status_t setCrop(const sp<SurfaceComposerClient>& client, SurfaceID id,
+ const Rect& crop);
static void closeGlobalTransaction(bool synchronous) {
Composer::getInstance().closeGlobalTransactionImpl(synchronous);
@@ -290,6 +292,17 @@ status_t Composer::setOrientation(int orientation) {
return NO_ERROR;
}
+status_t Composer::setCrop(const sp<SurfaceComposerClient>& client,
+ SurfaceID id, const Rect& crop) {
+ Mutex::Autolock _l(mLock);
+ layer_state_t* s = getLayerStateLocked(client, id);
+ if (!s)
+ return BAD_INDEX;
+ s->what |= ISurfaceComposer::eCropChanged;
+ s->crop = crop;
+ return NO_ERROR;
+}
+
// ---------------------------------------------------------------------------
SurfaceComposerClient::SurfaceComposerClient()
@@ -398,6 +411,10 @@ void SurfaceComposerClient::closeGlobalTransaction(bool synchronous) {
// ----------------------------------------------------------------------------
+status_t SurfaceComposerClient::setCrop(SurfaceID id, const Rect& crop) {
+ return getComposer().setCrop(this, id, crop);
+}
+
status_t SurfaceComposerClient::setFreezeTint(SurfaceID id, uint32_t tint) {
return getComposer().setFreezeTint(this, id, tint);
}