Skip to content

Fix PixelCopy snapshot for partially off-screen views (#56608)#56608

Open
zeyap wants to merge 2 commits intofacebook:mainfrom
zeyap:export-D102360642
Open

Fix PixelCopy snapshot for partially off-screen views (#56608)#56608
zeyap wants to merge 2 commits intofacebook:mainfrom
zeyap:export-D102360642

Conversation

@zeyap
Copy link
Copy Markdown
Contributor

@zeyap zeyap commented Apr 24, 2026

Summary:

[Internal] [Fixed] - Fix PixelCopy snapshot for partially off-screen

PixelCopy captures only the visible portion of the window surface.
When a view is partially off-screen, the capture rect extends beyond
the window bounds, resulting in a bitmap where only the visible
region has content. This partial bitmap then gets stretched to fill
the full-size pseudo-element, causing visual distortion.

Fix by clamping the PixelCopy rect to the window bounds and
compositing the clamped capture into a full-size bitmap at the
correct offset. The off-screen portions remain transparent instead
of being stretched.

If the view is entirely off-screen, skip capture entirely — the
pseudo-element will have no snapshot applied (didMountItems skips
tags without a captured bitmap).

Differential Revision: D102360642

@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 Apr 24, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Apr 24, 2026

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

zeyap added 2 commits April 24, 2026 09:58
…acebook#56604)

Summary:

## Changelog:

[Internal] [Fixed] - keep old snapshot node position updated at applyViewTransitionName

`createViewTransitionInstance` is only called once in a shadowNode's lifecycle but `applyViewTransitionName` will be called multiple times at each transition for the same shadowNode.

Reviewed By: christophpurrer

Differential Revision: D102226352
Summary:

[Internal] [Fixed] - Fix PixelCopy snapshot for partially off-screen 

PixelCopy captures only the visible portion of the window surface.
When a view is partially off-screen, the capture rect extends beyond
the window bounds, resulting in a bitmap where only the visible
region has content. This partial bitmap then gets stretched to fill
the full-size pseudo-element, causing visual distortion.

Fix by clamping the PixelCopy rect to the window bounds and
compositing the clamped capture into a full-size bitmap at the
correct offset. The off-screen portions remain transparent instead
of being stretched.

If the view is entirely off-screen, skip capture entirely — the
pseudo-element will have no snapshot applied (didMountItems skips
tags without a captured bitmap).

Differential Revision: D102360642
@meta-codesync meta-codesync Bot changed the title Fix PixelCopy snapshot for partially off-screen views Fix PixelCopy snapshot for partially off-screen views (#56608) Apr 24, 2026
@zeyap zeyap force-pushed the export-D102360642 branch from ff6b91c to ce54d82 Compare April 24, 2026 16:59
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.

1 participant