Enable edge antialiasing only for transforms with perspective (#19360)

Summary:
Enable edge antialiasing only for transforms with perspective

[iOS] [Added] - RCTViewManager: Enable edge antialiasing only for transforms with perspective.

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

Reviewed By: cpojer

Differential Revision: D14088290

Pulled By: hramos

fbshipit-source-id: 2113c7a29efce5ca9990e2a79c69fc70bdf8a041
This commit is contained in:
zhongwuzw
2019-02-15 10:03:15 -08:00
committed by Facebook Github Bot
parent f15145639d
commit cbf65f2cf4
3 changed files with 5 additions and 6 deletions

View File

@@ -550,7 +550,6 @@ RCT_EXTERN_C_END
[_invocation invokeWithTarget:module];
#endif
index = 2;
[_retainedObjects removeAllObjects];
if (_methodInfo->isSync) {

View File

@@ -133,7 +133,7 @@ RCT_EXPORT_MODULE()
- (void)setBridge:(RCTBridge *)bridge
{
RCTAssert(_bridge == nil, @"Should not re-use same UIIManager instance");
RCTAssert(_bridge == nil, @"Should not re-use same UIManager instance");
_bridge = bridge;
_shadowViewRegistry = [NSMutableDictionary new];
@@ -584,7 +584,7 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
if (view.reactLayoutDirection != layoutDirection) {
view.reactLayoutDirection = layoutDirection;
}
if (view.isHidden != isHidden) {
view.hidden = isHidden;
}
@@ -1542,7 +1542,7 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(lazilyLoadView:(NSString *)name)
// which had RCT Prefixes stripped. Lets check one more time...
module = [self.bridge moduleForName:RCTDropReactPrefixes(moduleName)];
}
if (!module) {
return @{};
}

View File

@@ -147,8 +147,8 @@ RCT_CUSTOM_VIEW_PROPERTY(shouldRasterizeIOS, BOOL, RCTView)
RCT_CUSTOM_VIEW_PROPERTY(transform, CATransform3D, RCTView)
{
view.layer.transform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.transform;
// TODO: Improve this by enabling edge antialiasing only for transforms with rotation or skewing
view.layer.allowsEdgeAntialiasing = !CATransform3DIsIdentity(view.layer.transform);
// Enable edge antialiasing in perspective transforms
view.layer.allowsEdgeAntialiasing = !(view.layer.transform.m34 == 0.0f);
}
RCT_CUSTOM_VIEW_PROPERTY(accessibilityRole, UIAccessibilityTraits, RCTView)