Skip to content

Commit

Permalink
Enable edgeAntiAliasing only for specific transforms (#40943)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #40943

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

Source: #32920

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

Reviewed By: sammy-SC

Differential Revision: D50270444

fbshipit-source-id: 8a08039c42f8fb855db2ace140124c33f18dc3bc
  • Loading branch information
javache authored and facebook-github-bot committed Oct 16, 2023
1 parent bbc517c commit 6fb0fba
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,11 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
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`
Expand Down

0 comments on commit 6fb0fba

Please sign in to comment.