Skip to content

Fix bug where offscreen layers would erroneously draw black pixels#55762

Open
Abbondanzo wants to merge 1 commit intofacebook:mainfrom
Abbondanzo:export-D94447724
Open

Fix bug where offscreen layers would erroneously draw black pixels#55762
Abbondanzo wants to merge 1 commit intofacebook:mainfrom
Abbondanzo:export-D94447724

Conversation

@Abbondanzo
Copy link
Contributor

Summary:
On API <= 28, clipWithAntiAliasing uses saveLayer for anti-aliased border radius clipping. When a view is partially off-screen, the GPU only renders into the visible portion of the saveLayer buffer, leaving off-screen pixels as opaque black. These black pixels survive Porter-Duff compositing and appear as visible artifacts.

Adding canvas.clipRect(0, 0, view.width, view.height) before saveLayer forces HWUI to properly initialize the offscreen buffer relative to the GPU scissor. The clip is in local coordinates, so it stays correct across parent transform animations and scrolling offsets.

Changelog: [Internal]

Differential Revision: D94447724

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 26, 2026
@meta-codesync
Copy link

meta-codesync bot commented Feb 26, 2026

@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D94447724.

Abbondanzo added a commit to Abbondanzo/react-native that referenced this pull request Feb 26, 2026
…acebook#55762)

Summary:

On API <= 28, `clipWithAntiAliasing` uses `saveLayer` for anti-aliased border radius clipping. When a view is partially off-screen, the GPU only renders into the visible portion of the `saveLayer` buffer, leaving off-screen pixels as opaque black. These black pixels survive Porter-Duff compositing and appear as visible artifacts.

Adding `canvas.clipRect(0, 0, view.width, view.height)` before `saveLayer` forces HWUI to properly initialize the offscreen buffer relative to the GPU scissor. The clip is in local coordinates, so it stays correct across parent transform animations and scrolling offsets.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D94447724
…acebook#55762)

Summary:

On API <= 28, `clipWithAntiAliasing` uses `saveLayer` for anti-aliased border radius clipping. When a view is partially off-screen, the GPU only renders into the visible portion of the `saveLayer` buffer, leaving off-screen pixels as opaque black. These black pixels survive Porter-Duff compositing and appear as visible artifacts.

Adding `canvas.clipRect(0, 0, view.width, view.height)` before `saveLayer` forces HWUI to properly initialize the offscreen buffer relative to the GPU scissor. The clip is in local coordinates, so it stays correct across parent transform animations and scrolling offsets.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D94447724
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants