summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--native/android/libandroid.map.txt5
-rw-r--r--native/android/surface_control.cpp36
2 files changed, 26 insertions, 15 deletions
diff --git a/native/android/libandroid.map.txt b/native/android/libandroid.map.txt
index 4d137e0e1acc..9729524b47b2 100644
--- a/native/android/libandroid.map.txt
+++ b/native/android/libandroid.map.txt
@@ -260,8 +260,9 @@ LIBANDROID {
ASurfaceTransaction_setHdrMetadata_smpte2086; # introduced=29
ASurfaceTransaction_setOnComplete; # introduced=29
ASurfaceTransaction_setPosition; # introduced=31
- ASurfaceTransaction_setSourceRect; # introduced=31
- ASurfaceTransaction_setTransform; # introduced=31
+ ASurfaceTransaction_setCrop; # introduced=31
+ ASurfaceTransaction_setBufferTransform; # introduced=31
+ ASurfaceTransaction_setScale; # introduced=31
ASurfaceTransaction_setVisibility; # introduced=29
ASurfaceTransaction_setZOrder; # introduced=29
ASystemFontIterator_open; # introduced=29
diff --git a/native/android/surface_control.cpp b/native/android/surface_control.cpp
index 7433cf970566..3d14c425ed4d 100644
--- a/native/android/surface_control.cpp
+++ b/native/android/surface_control.cpp
@@ -459,34 +459,31 @@ void ASurfaceTransaction_setGeometry(ASurfaceTransaction* aSurfaceTransaction,
transaction->setTransformToDisplayInverse(surfaceControl, transformToInverseDisplay);
}
-void ASurfaceTransaction_setSourceRect(ASurfaceTransaction* aSurfaceTransaction,
- ASurfaceControl* aSurfaceControl, const ARect& source) {
+void ASurfaceTransaction_setCrop(ASurfaceTransaction* aSurfaceTransaction,
+ ASurfaceControl* aSurfaceControl, const ARect& crop) {
CHECK_NOT_NULL(aSurfaceTransaction);
CHECK_NOT_NULL(aSurfaceControl);
- CHECK_VALID_RECT(source);
+ CHECK_VALID_RECT(crop);
sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl);
Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction);
- transaction->setCrop(surfaceControl, static_cast<const Rect&>(source));
+ transaction->setCrop(surfaceControl, static_cast<const Rect&>(crop));
}
-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, int32_t x, int32_t y) {
+ 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->setPosition(surfaceControl, x, y);
}
-void ASurfaceTransaction_setTransform(ASurfaceTransaction* aSurfaceTransaction,
- ASurfaceControl* aSurfaceControl, int32_t transform) {
+void ASurfaceTransaction_setBufferTransform(ASurfaceTransaction* aSurfaceTransaction,
+ ASurfaceControl* aSurfaceControl, int32_t transform) {
CHECK_NOT_NULL(aSurfaceTransaction);
CHECK_NOT_NULL(aSurfaceControl);
@@ -499,6 +496,19 @@ void ASurfaceTransaction_setTransform(ASurfaceTransaction* aSurfaceTransaction,
transaction->setTransformToDisplayInverse(surfaceControl, transformToInverseDisplay);
}
+void ASurfaceTransaction_setScale(ASurfaceTransaction* aSurfaceTransaction,
+ ASurfaceControl* aSurfaceControl, float xScale, float yScale) {
+ CHECK_NOT_NULL(aSurfaceTransaction);
+ CHECK_NOT_NULL(aSurfaceControl);
+ LOG_ALWAYS_FATAL_IF(xScale < 0, "negative value passed in for xScale");
+ LOG_ALWAYS_FATAL_IF(yScale < 0, "negative value passed in for yScale");
+
+ sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl);
+ Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction);
+
+ transaction->setMatrix(surfaceControl, xScale, 0, 0, yScale);
+}
+
void ASurfaceTransaction_setBufferTransparency(ASurfaceTransaction* aSurfaceTransaction,
ASurfaceControl* aSurfaceControl,
int8_t transparency) {