From cbf65f2cf424b38f1449b504849bad367d2856dc Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Fri, 15 Feb 2019 10:03:15 -0800 Subject: [PATCH] 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 --- React/Base/RCTModuleMethod.mm | 1 - React/Modules/RCTUIManager.m | 6 +++--- React/Views/RCTViewManager.m | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/React/Base/RCTModuleMethod.mm b/React/Base/RCTModuleMethod.mm index e9a365758..767e11abd 100644 --- a/React/Base/RCTModuleMethod.mm +++ b/React/Base/RCTModuleMethod.mm @@ -550,7 +550,6 @@ RCT_EXTERN_C_END [_invocation invokeWithTarget:module]; #endif - index = 2; [_retainedObjects removeAllObjects]; if (_methodInfo->isSync) { diff --git a/React/Modules/RCTUIManager.m b/React/Modules/RCTUIManager.m index dfac9a87f..2bfeaf7fd 100644 --- a/React/Modules/RCTUIManager.m +++ b/React/Modules/RCTUIManager.m @@ -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 @{}; } diff --git a/React/Views/RCTViewManager.m b/React/Views/RCTViewManager.m index c6570b58b..35cd1dafe 100644 --- a/React/Views/RCTViewManager.m +++ b/React/Views/RCTViewManager.m @@ -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)