summaryrefslogtreecommitdiff
path: root/native
diff options
context:
space:
mode:
authorOrion Hodson <oth@google.com>2021-04-08 12:30:21 +0000
committerOrion Hodson <oth@google.com>2021-04-08 12:30:21 +0000
commit98aa7d4c88834987d5102f0137d206e921583ace (patch)
treeba058401494fd4519ffda1380056d650b8e62fa0 /native
parent5bdebd04defe5ad7e54a585b3023aa29ba7e78f8 (diff)
Revert "Remove setFrame from surface_control setGeometry"
Revert "Remove setFrame from BufferStateLayer" Revert "Update tests to reflect the new behavior for setGeometry" Revert submission 13843937-sc_remove_set_frame Reason for revert: Candidate CL for b/184807094 Reverted Changes: Iffbd955a3:Remove setFrame I27f17bc61:Update tests to reflect the new behavior for setGe... I5720276c1:Remove setFrame from surface_control setGeometry I32ee0e3e4:Remove setFrame from BufferStateLayer Bug: 184807094 Change-Id: I7f6f0d7799e6e2858af2ce2e8acb5c67db8714f8
Diffstat (limited to 'native')
-rw-r--r--native/android/surface_control.cpp29
1 files changed, 7 insertions, 22 deletions
diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp
index b24bf2e27c5b..195fd5e60295 100644
--- a/native/android/surface_control.cpp
+++ b/native/android/surface_control.cpp
@@ -432,27 +432,14 @@ void ASurfaceTransaction_setGeometry(ASurfaceTransaction* aSurfaceTransaction,
const ARect& destination, int32_t transform) {
CHECK_NOT_NULL(aSurfaceTransaction);
CHECK_NOT_NULL(aSurfaceControl);
+ CHECK_VALID_RECT(source);
CHECK_VALID_RECT(destination);
- Rect sourceRect = static_cast<const Rect&>(source);
- // Adjust the source so its top and left are not negative
- sourceRect.left = std::max(sourceRect.left, 0);
- sourceRect.top = std::max(sourceRect.top, 0);
- LOG_ALWAYS_FATAL_IF(sourceRect.isEmpty(), "invalid arg passed as source argument");
-
sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl);
Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction);
- transaction->setCrop(surfaceControl, sourceRect);
-
- float dsdx = (destination.right - destination.left) /
- static_cast<float>(sourceRect.right - sourceRect.left);
- float dsdy = (destination.bottom - destination.top) /
- static_cast<float>(sourceRect.bottom - sourceRect.top);
-
- transaction->setPosition(surfaceControl, destination.left - (sourceRect.left * dsdx),
- destination.top - (sourceRect.top * dsdy));
- transaction->setMatrix(surfaceControl, dsdx, 0, 0, dsdy);
+ transaction->setCrop(surfaceControl, static_cast<const Rect&>(source));
+ transaction->setFrame(surfaceControl, static_cast<const Rect&>(destination));
transaction->setTransform(surfaceControl, transform);
bool transformToInverseDisplay = (NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY & transform) ==
NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY;
@@ -471,18 +458,16 @@ void ASurfaceTransaction_setSourceRect(ASurfaceTransaction* aSurfaceTransaction,
transaction->setCrop(surfaceControl, static_cast<const Rect&>(source));
}
-void ASurfaceTransaction_setPosition(ASurfaceTransaction* /* aSurfaceTransaction */,
- ASurfaceControl* /* aSurfaceControl */,
- const ARect& /* destination */) {
- // TODO: Fix this function
- /* CHECK_NOT_NULL(aSurfaceTransaction);
+void ASurfaceTransaction_setPosition(ASurfaceTransaction* aSurfaceTransaction,
+ ASurfaceControl* aSurfaceControl, const ARect& destination) {
+ CHECK_NOT_NULL(aSurfaceTransaction);
CHECK_NOT_NULL(aSurfaceControl);
CHECK_VALID_RECT(destination);
sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl);
Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction);
- transaction->setFrame(surfaceControl, static_cast<const Rect&>(destination));*/
+ transaction->setFrame(surfaceControl, static_cast<const Rect&>(destination));
}
void ASurfaceTransaction_setTransform(ASurfaceTransaction* aSurfaceTransaction,