Commit ce54d82
Fix PixelCopy snapshot for partially off-screen views (facebook#56608)
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: D1023606421 parent ca53608 commit ce54d82
1 file changed
Lines changed: 39 additions & 13 deletions
File tree
- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric
Lines changed: 39 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | 106 | | |
108 | 107 | | |
109 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
110 | 136 | | |
111 | 137 | | |
112 | 138 | | |
113 | 139 | | |
114 | 140 | | |
115 | | - | |
116 | | - | |
| 141 | + | |
| 142 | + | |
117 | 143 | | |
118 | 144 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
126 | 152 | | |
127 | | - | |
| 153 | + | |
128 | 154 | | |
129 | 155 | | |
130 | 156 | | |
| |||
133 | 159 | | |
134 | 160 | | |
135 | 161 | | |
136 | | - | |
| 162 | + | |
137 | 163 | | |
138 | 164 | | |
139 | 165 | | |
| |||
0 commit comments