Avoid Image ofscreen render#45948
Closed
NickGerleman wants to merge 3 commits into
Closed
Conversation
…#45805) Summary: Pull Request resolved: facebook#45805 After recent changes where we dive into paths ourselves, we really don't have a good reason to use the heavy CSSBackgroundDrawable. Accept a box shadow style in place of a reference to the original drawable, and then draw using calculated round rect path instead of new whole Drawable. This lets us avoid a lot of conversions as well (with the last diff already removing some). This should also resolve a crash we started seeing: ``` androidx.core.util.Preconditions.checkNotNull (Preconditions.java:136) [inlined] - com.facebook.react.uimanager.drawable.CSSBackgroundDrawable.drawRoundedBackgroundWithBorders (CSSBackgroundDrawable.java:386) [inlined] - com.facebook.react.uimanager.drawable.CSSBackgroundDrawable.draw (CSSBackgroundDrawable.java:142) - com.facebook.react.uimanager.drawable.OutsetBoxShadowDrawable.draw (OutsetBoxShadowDrawable.kt:137) - android.graphics.drawable.LayerDrawable.draw (LayerDrawable.java:1019) ``` Changelog: [Internal] Differential Revision: D60401423
Summary: This adjusts logic to be similar to InsetBoxShadowDrawable to keep the full ink within RenderNode bounds. This avoids a tiny bit of overdraw, but also means we get correct rendering if RenderNode is promoted to a compositing layer. Changelog: [Internal] Differential Revision: D60972085
Summary: This change effectively reverts D59489788 which fixed Image implementation of `hasOverlappingRendering()`. When this is true, Android will draw offscreen, then composite the rasterized layer with alpha in one pass, instead of drawing each element with alpha (which results in incorrect rendering). The unforseen downside is that this prevents drawing overflow, which means images with non-full opacity break box shadows and outline in the future. This deserves a fuller fix... but in the meantime, I discovered we disable offscreen alpha in many of the core components already, with `<View>` as a major example requiring explicit opt-in. This is... kinda terrible, since `opacity` rendering is pretty broken on RN Android, but the status quo lets us avoid a pretty bad boxShadow bug for now. Changelog: [Android][Changed] - Avoid image ofscreen render Differential Revision: D60972846
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D60972846 |
Contributor
|
This pull request has been merged in 620b122. |
Collaborator
|
This pull request was successfully merged by @NickGerleman in 620b122 When will my fix make it into a release? | How to file a pick request? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This change effectively reverts D59489788 which fixed Image implementation of
hasOverlappingRendering(). When this is true, Android will draw offscreen, then composite the rasterized layer with alpha in one pass, instead of drawing each element with alpha (which results in incorrect rendering).The unforseen downside is that this prevents drawing overflow, which means images with non-full opacity break box shadows and outline in the future.
This deserves a fuller fix... but in the meantime, I discovered we disable offscreen alpha in many of the core components already, with
<View>as a major example requiring explicit opt-in. This is... kinda terrible, sinceopacityrendering is pretty broken on RN Android, but the status quo lets us avoid a pretty bad boxShadow bug for now.Changelog:
[Android][Changed] - Avoid image ofscreen render
Differential Revision: D60972846