From 6f88a608d29f6136a5c49f24acdeb01f6103fe76 Mon Sep 17 00:00:00 2001 From: Jorge Cabiedes Acosta Date: Fri, 30 Aug 2024 13:15:35 -0700 Subject: [PATCH] Fix small border radius getting capped (#46251) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46251 The diff D21124739 introduced this as a workaround for some faulty logic we used to have. It seems like we no longer need it and it was actually causing issues with small border radii. Its barely noticeable but Outline looks weird in some cases if we leave it as is Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D61938725 fbshipit-source-id: cf7ee7417e1085d01e2e307e780ff5d1db499e69 --- .../drawable/CSSBackgroundDrawable.java | 44 ++++--------------- 1 file changed, 8 insertions(+), 36 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CSSBackgroundDrawable.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CSSBackgroundDrawable.java index bf5c1994e6e..205bf491f79 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CSSBackgroundDrawable.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CSSBackgroundDrawable.java @@ -767,42 +767,14 @@ public class CSSBackgroundDrawable extends Drawable { mCenterDrawPath.addRoundRect( mTempRectForCenterDrawPath, new float[] { - Math.max( - topLeftRadius.getHorizontal() - borderWidth.left * 0.5f, - (borderWidth.left > 0.0f) - ? (topLeftRadius.getHorizontal() / borderWidth.left) - : 0.0f), - Math.max( - topLeftRadius.getVertical() - borderWidth.top * 0.5f, - (borderWidth.top > 0.0f) ? (topLeftRadius.getVertical() / borderWidth.top) : 0.0f), - Math.max( - topRightRadius.getHorizontal() - borderWidth.right * 0.5f, - (borderWidth.right > 0.0f) - ? (topRightRadius.getHorizontal() / borderWidth.right) - : 0.0f), - Math.max( - topRightRadius.getVertical() - borderWidth.top * 0.5f, - (borderWidth.top > 0.0f) ? (topRightRadius.getVertical() / borderWidth.top) : 0.0f), - Math.max( - bottomRightRadius.getHorizontal() - borderWidth.right * 0.5f, - (borderWidth.right > 0.0f) - ? (bottomRightRadius.getHorizontal() / borderWidth.right) - : 0.0f), - Math.max( - bottomRightRadius.getVertical() - borderWidth.bottom * 0.5f, - (borderWidth.bottom > 0.0f) - ? (bottomRightRadius.getVertical() / borderWidth.bottom) - : 0.0f), - Math.max( - bottomLeftRadius.getHorizontal() - borderWidth.left * 0.5f, - (borderWidth.left > 0.0f) - ? (bottomLeftRadius.getHorizontal() / borderWidth.left) - : 0.0f), - Math.max( - bottomLeftRadius.getVertical() - borderWidth.bottom * 0.5f, - (borderWidth.bottom > 0.0f) - ? (bottomLeftRadius.getVertical() / borderWidth.bottom) - : 0.0f) + topLeftRadius.getHorizontal() - borderWidth.left * 0.5f, + topLeftRadius.getVertical() - borderWidth.top * 0.5f, + topRightRadius.getHorizontal() - borderWidth.right * 0.5f, + topRightRadius.getVertical() - borderWidth.top * 0.5f, + bottomRightRadius.getHorizontal() - borderWidth.right * 0.5f, + bottomRightRadius.getVertical() - borderWidth.bottom * 0.5f, + bottomLeftRadius.getHorizontal() - borderWidth.left * 0.5f, + bottomLeftRadius.getVertical() - borderWidth.bottom * 0.5f, }, Path.Direction.CW);