Skip to content

Commit

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

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

Source: facebook#32920

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

Reviewed By: sammy-SC

Differential Revision: D50270444
  • Loading branch information
javache authored and facebook-github-bot committed Oct 16, 2023
1 parent 6991db0 commit a9eb57f
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 a9eb57f

Please sign in to comment.