Split ASurfaceTransaction_setGeometry api

This CL adds three new methods: setSourceRect, setPosition and
setTransform.

Test: ASurfaceControlTest
Bug: 173671170
Change-Id: I00f05a45bfa2b6e53735d95977d32bdecbce3df1
This commit is contained in:
Vasiliy Telezhnikov
2021-03-13 19:55:00 -05:00
parent 11a7f13364
commit 5ead3aa5f2
2 changed files with 42 additions and 1 deletions

View File

@@ -258,6 +258,9 @@ LIBANDROID {
ASurfaceTransaction_setHdrMetadata_cta861_3; # introduced=29
ASurfaceTransaction_setHdrMetadata_smpte2086; # introduced=29
ASurfaceTransaction_setOnComplete; # introduced=29
ASurfaceTransaction_setPosition; # introduced=31
ASurfaceTransaction_setSourceRect; # introduced=31
ASurfaceTransaction_setTransform; # introduced=31
ASurfaceTransaction_setVisibility; # introduced=29
ASurfaceTransaction_setZOrder; # introduced=29
ASystemFontIterator_open; # introduced=29
@@ -309,4 +312,4 @@ LIBANDROID_PLATFORM {
ASurfaceControlStats_getAcquireTime*;
ASurfaceControlStats_getFrameNumber*;
};
} LIBANDROID;
} LIBANDROID;

View File

@@ -446,6 +446,44 @@ void ASurfaceTransaction_setGeometry(ASurfaceTransaction* aSurfaceTransaction,
transaction->setTransformToDisplayInverse(surfaceControl, transformToInverseDisplay);
}
void ASurfaceTransaction_setSourceRect(ASurfaceTransaction* aSurfaceTransaction,
ASurfaceControl* aSurfaceControl, const ARect& source) {
CHECK_NOT_NULL(aSurfaceTransaction);
CHECK_NOT_NULL(aSurfaceControl);
CHECK_VALID_RECT(source);
sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl);
Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction);
transaction->setCrop(surfaceControl, static_cast<const Rect&>(source));
}
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));
}
void ASurfaceTransaction_setTransform(ASurfaceTransaction* aSurfaceTransaction,
ASurfaceControl* aSurfaceControl, int32_t transform) {
CHECK_NOT_NULL(aSurfaceTransaction);
CHECK_NOT_NULL(aSurfaceControl);
sp<SurfaceControl> surfaceControl = ASurfaceControl_to_SurfaceControl(aSurfaceControl);
Transaction* transaction = ASurfaceTransaction_to_Transaction(aSurfaceTransaction);
transaction->setTransform(surfaceControl, transform);
bool transformToInverseDisplay = (NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY & transform) ==
NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY;
transaction->setTransformToDisplayInverse(surfaceControl, transformToInverseDisplay);
}
void ASurfaceTransaction_setBufferTransparency(ASurfaceTransaction* aSurfaceTransaction,
ASurfaceControl* aSurfaceControl,
int8_t transparency) {