From 4fef34e1fd07fe64883f0dead13b52e6eb128eed Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Wed, 31 Jul 2024 10:13:20 -0700 Subject: [PATCH] Don't call cornerRadiiForBoxShadow if we don't have to (#45679) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45679 `cornerRadiiForBoxShadow(cornerRadii, 0)` no-ops since there is no spread, and it returns the same type as it takes as an input, so there is no point for this complexity Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D60203620 fbshipit-source-id: c1f86ce6e8fef07365ab57caa3e906f1601a0c2b --- packages/react-native/React/Fabric/Utils/RCTBoxShadow.mm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/react-native/React/Fabric/Utils/RCTBoxShadow.mm b/packages/react-native/React/Fabric/Utils/RCTBoxShadow.mm index 4918f6d199f..15de0945f2a 100644 --- a/packages/react-native/React/Fabric/Utils/RCTBoxShadow.mm +++ b/packages/react-native/React/Fabric/Utils/RCTBoxShadow.mm @@ -145,8 +145,7 @@ static void renderOutsetShadows( } // Lastly, clear out the region inside the view so that the shadows do // not cover its content - const RCTCornerInsets layerCornerInsets = - RCTGetCornerInsets(cornerRadiiForBoxShadow(cornerRadii, 0), UIEdgeInsetsZero); + const RCTCornerInsets layerCornerInsets = RCTGetCornerInsets(cornerRadii, UIEdgeInsetsZero); CGPathRef shadowPathAlignedWithLayer = RCTPathCreateWithRoundedRect( CGRectMake(-boundingRect.origin.x, -boundingRect.origin.y, layer.bounds.size.width, layer.bounds.size.height), layerCornerInsets, @@ -187,8 +186,7 @@ static void renderInsetShadows( // Add the path twice so we only draw inside the view with the EO crop rule CGContextAddRect(context, outerClippingRect); CGContextAddRect(context, outerClippingRect); - const RCTCornerInsets cornerInsetsForLayer = - RCTGetCornerInsets(cornerRadiiForBoxShadow(cornerRadii, 0), UIEdgeInsetsZero); + const RCTCornerInsets cornerInsetsForLayer = RCTGetCornerInsets(cornerRadii, UIEdgeInsetsZero); CGPathRef layerPath = RCTPathCreateWithRoundedRect( CGRectMake(-boundingRect.origin.x, -boundingRect.origin.y, layer.bounds.size.width, layer.bounds.size.height), cornerInsetsForLayer,