blast: use frame instead of size and position
BufferStateLayers will have a source crop rect and destination
frame rect. The crop is the portion of the buffer that should be
displayed. The frame is where that portion of the buffer should
be displayed. The portion of the cropped buffer is scaled to fit
the frame.
Shader provided by romainguy@google.com.
Test: Transaction_test
Bug: 80477568
Change-Id: Ied3f3af2211132f79098aeb986292ee705a62219
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 9dfccc7..a51af2c 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -609,6 +609,20 @@
return *this;
}
+SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFrame(
+ const sp<SurfaceControl>& sc, const Rect& frame) {
+ layer_state_t* s = getLayerState(sc);
+ if (!s) {
+ mStatus = BAD_INDEX;
+ return *this;
+ }
+ s->what |= layer_state_t::eFrameChanged;
+ s->frame = frame;
+
+ registerSurfaceControlForCallback(sc);
+ return *this;
+}
+
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setBuffer(
const sp<SurfaceControl>& sc, const sp<GraphicBuffer>& buffer) {
layer_state_t* s = getLayerState(sc);