Commit d0015e0
Fix visual artifacts when sometimes using decimal assymetric borderRadii (#54237)
Summary:
Pull Request resolved: #54237
Before we were adding a single pixel for the stretchable area. in RCTViewComponentView we calculate what percentage is 1 pixel from the entire image to create the unit rectangle:
```
CGRect contentsCenter = CGRect{
CGPoint{imageCapInsets.left / imageSize.width, imageCapInsets.top / imageSize.height},
CGSize{(CGFloat)1.0 / imageSize.width, (CGFloat)1.0 / imageSize.height}};
```
However sometimes when dividing `1.0 / imageSize.width` we would get a big enough float that causes a rounding error essentially having part of the border bleed into the stretchable region.
The easiest way to fix this is give the stretchable region a little more space so to prevent the bleeding.
We can do this by rounding the edgeInsets that give the border area its size
The alternative is some shockingly complex math to appropriately calculate the most convenient stretchable area size
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D85260693
fbshipit-source-id: 50eaba2189f3ff524be730211f8d19023522c68a1 parent 26ad949 commit d0015e0
1 file changed
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
251 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
252 | 256 | | |
253 | 257 | | |
254 | 258 | | |
| |||
0 commit comments