Anti-alias rounded borders on overflow: hidden views

Summary:
When a view is rendered with a combination of `overflow: hidden` and `borderRadius: >0`, the `ReactViewGroup` would apply the border radius using Canvas `clipPath`. In Android graphics, clipPath is not an anti-aliased operation and caused aliasing artifacts.

Changing the method to a bitmask using the `PorterDuff` method results in the same functionality, but with hardware accelerated antialiasing.

https://github.com/facebook/react-native/issues/24486

Changelog:
[Android][Change] - Views with overflow: hidden and borderRadius: >0 now render anti-aliased borders.

Reviewed By: javache

Differential Revision: D38914878

fbshipit-source-id: 45ac7e4aece7a76c4216412175e49d3d73b6f391
This commit is contained in:
Harrison Spain
2022-08-25 14:25:08 -07:00
committed by Facebook GitHub Bot
parent 18542b6ef5
commit 7708cdccef
2 changed files with 44 additions and 4 deletions
@@ -144,4 +144,10 @@ public class ReactFeatureFlags {
/** Temporary flag to allow execution of mount items up to 15ms earlier than normal. */
public static boolean enableEarlyScheduledMountItemExecution = false;
/**
* Use a bitmap mask instead of clipPath for rounding corners so that they are antialiased in
* Android
*/
public static boolean antiAliasRoundedOverflowCorners = false;
}