From f3f40fefdd67eab97aefdd62a08ab99eef442039 Mon Sep 17 00:00:00 2001 From: chaviw Date: Tue, 27 Apr 2021 15:54:02 -0500 Subject: Added setBufferCrop Added setBufferCrop to handle setGeometry calls from the public SurfaceControl. This is because setGeometry gets crop in buffer space, but setCrop can only handle layer space crop. Added setBufferCrop to handle this case Test: ASurfaceControlTest Fixes: 186266903 Change-Id: I14fb329d2d6f504ca8fa8e330c8a036cbde56f28 --- libs/gui/SurfaceComposerClient.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 5db0eae416..808b731d8f 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -1664,6 +1664,21 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setStret return *this; } +SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBufferCrop( + const sp& sc, const Rect& bufferCrop) { + layer_state_t* s = getLayerState(sc); + if (!s) { + mStatus = BAD_INDEX; + return *this; + } + + s->what |= layer_state_t::eBufferCropChanged; + s->bufferCrop = bufferCrop; + + registerSurfaceControlForCallback(sc); + return *this; +} + // --------------------------------------------------------------------------- DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp& token) { -- cgit v1.2.3-59-g8ed1b