summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorPablo Ceballos2016-03-23 11:30:52 -0500
committerAndroid (Google) Code Review2016-03-23 11:30:54 -0500
commit41371bfa0dad4a4332a8cc30b066d95546e4c4fc (patch)
tree04f217184a1de7952c8d041bc0f8f0a7cb0e76b4 /libs
parent5b817549fcea6f58bbeaaffbf654ddd8751ebbdc (diff)
parentacbe67888f0bd65d5400400f0115bae6bd6199dc (diff)
downloadframeworks-native-41371bfa0dad4a4332a8cc30b066d95546e4c4fc.tar.gz
frameworks-native-41371bfa0dad4a4332a8cc30b066d95546e4c4fc.tar.xz
frameworks-native-41371bfa0dad4a4332a8cc30b066d95546e4c4fc.zip
Merge "Add final crop implementation" into nyc-dev
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/LayerState.cpp2
-rw-r--r--libs/gui/SurfaceComposerClient.cpp19
-rw-r--r--libs/gui/SurfaceControl.cpp5
3 files changed, 26 insertions, 0 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 06f13e8b2..e43342e34 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -38,6 +38,7 @@ status_t layer_state_t::write(Parcel& output) const
38 *reinterpret_cast<layer_state_t::matrix22_t *>( 38 *reinterpret_cast<layer_state_t::matrix22_t *>(
39 output.writeInplace(sizeof(layer_state_t::matrix22_t))) = matrix; 39 output.writeInplace(sizeof(layer_state_t::matrix22_t))) = matrix;
40 output.write(crop); 40 output.write(crop);
41 output.write(finalCrop);
41 output.writeStrongBinder(handle); 42 output.writeStrongBinder(handle);
42 output.writeUint64(frameNumber); 43 output.writeUint64(frameNumber);
43 output.write(transparentRegion); 44 output.write(transparentRegion);
@@ -64,6 +65,7 @@ status_t layer_state_t::read(const Parcel& input)
64 return BAD_VALUE; 65 return BAD_VALUE;
65 } 66 }
66 input.read(crop); 67 input.read(crop);
68 input.read(finalCrop);
67 handle = input.readStrongBinder(); 69 handle = input.readStrongBinder();
68 frameNumber = input.readUint64(); 70 frameNumber = input.readUint64();
69 input.read(transparentRegion); 71 input.read(transparentRegion);
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 3242f550f..04b5446d4 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -156,6 +156,8 @@ public:
156 status_t setOrientation(int orientation); 156 status_t setOrientation(int orientation);
157 status_t setCrop(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, 157 status_t setCrop(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
158 const Rect& crop); 158 const Rect& crop);
159 status_t setFinalCrop(const sp<SurfaceComposerClient>& client,
160 const sp<IBinder>& id, const Rect& crop);
159 status_t setLayerStack(const sp<SurfaceComposerClient>& client, 161 status_t setLayerStack(const sp<SurfaceComposerClient>& client,
160 const sp<IBinder>& id, uint32_t layerStack); 162 const sp<IBinder>& id, uint32_t layerStack);
161 status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client, 163 status_t deferTransactionUntil(const sp<SurfaceComposerClient>& client,
@@ -386,6 +388,18 @@ status_t Composer::setCrop(const sp<SurfaceComposerClient>& client,
386 return NO_ERROR; 388 return NO_ERROR;
387} 389}
388 390
391status_t Composer::setFinalCrop(const sp<SurfaceComposerClient>& client,
392 const sp<IBinder>& id, const Rect& crop) {
393 Mutex::Autolock _l(mLock);
394 layer_state_t* s = getLayerStateLocked(client, id);
395 if (!s) {
396 return BAD_INDEX;
397 }
398 s->what |= layer_state_t::eFinalCropChanged;
399 s->finalCrop = crop;
400 return NO_ERROR;
401}
402
389status_t Composer::deferTransactionUntil( 403status_t Composer::deferTransactionUntil(
390 const sp<SurfaceComposerClient>& client, const sp<IBinder>& id, 404 const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
391 const sp<IBinder>& handle, uint64_t frameNumber) { 405 const sp<IBinder>& handle, uint64_t frameNumber) {
@@ -579,6 +593,11 @@ status_t SurfaceComposerClient::setCrop(const sp<IBinder>& id, const Rect& crop)
579 return getComposer().setCrop(this, id, crop); 593 return getComposer().setCrop(this, id, crop);
580} 594}
581 595
596status_t SurfaceComposerClient::setFinalCrop(const sp<IBinder>& id,
597 const Rect& crop) {
598 return getComposer().setFinalCrop(this, id, crop);
599}
600
582status_t SurfaceComposerClient::setPosition(const sp<IBinder>& id, float x, float y) { 601status_t SurfaceComposerClient::setPosition(const sp<IBinder>& id, float x, float y) {
583 return getComposer().setPosition(this, id, x, y); 602 return getComposer().setPosition(this, id, x, y);
584} 603}
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index e1a951c93..184de7198 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -152,6 +152,11 @@ status_t SurfaceControl::setCrop(const Rect& crop) {
152 if (err < 0) return err; 152 if (err < 0) return err;
153 return mClient->setCrop(mHandle, crop); 153 return mClient->setCrop(mHandle, crop);
154} 154}
155status_t SurfaceControl::setFinalCrop(const Rect& crop) {
156 status_t err = validate();
157 if (err < 0) return err;
158 return mClient->setFinalCrop(mHandle, crop);
159}
155 160
156status_t SurfaceControl::deferTransactionUntil(sp<IBinder> handle, 161status_t SurfaceControl::deferTransactionUntil(sp<IBinder> handle,
157 uint64_t frameNumber) { 162 uint64_t frameNumber) {