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
This commit is contained in:
Joe Vilches
2024-07-31 10:13:20 -07:00
committed by Facebook GitHub Bot
parent e6ef47aff8
commit 4fef34e1fd
@@ -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,