Enable edgeAntiAliasing only for specific transforms (#40943)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40943

We should enable antialiasing when it's necessary, as it's an expensive property. Scale and Translate transforms shouldn't enable it.

Source: https://github.com/facebook/react-native/pull/32920

Changelog: [iOS][Changed] Matched behaviour for allowsEdgeAntialiasing to old architecture.

Reviewed By: sammy-SC

Differential Revision: D50270444

fbshipit-source-id: 8a08039c42f8fb855db2ace140124c33f18dc3bc
This commit is contained in:
Pieter De Baets 2023-10-16 06:21:03 -07:00 коммит произвёл Facebook GitHub Bot
Родитель bbc517c8c8
Коммит 6fb0fbadc0
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -265,8 +265,11 @@ using namespace facebook::react;
oldViewProps.transformOrigin != newViewProps.transformOrigin) &&
![_propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN containsObject:@"transform"]) {
auto newTransform = newViewProps.resolveTransform(_layoutMetrics);
self.layer.transform = RCTCATransform3DFromTransformMatrix(newTransform);
self.layer.allowsEdgeAntialiasing = newViewProps.transform != Transform::Identity();
CATransform3D caTransform = RCTCATransform3DFromTransformMatrix(newTransform);
self.layer.transform = caTransform;
// Enable edge antialiasing in rotation, skew, or perspective transforms
self.layer.allowsEdgeAntialiasing = caTransform.m12 != 0.0f || caTransform.m21 != 0.0f || caTransform.m34 != 0.0f;
}
// `hitSlop`