Repository navigation
Scale high-pixel-ratio images with BoxFit.none/BoxFit.scaleDown correctly - #20791
Conversation
|
@Hixie This is ready for review. I added a few unit tests to test the correct scaling and positioning of images on the canvas, with different After all golden tests were not required, a Here is a screenshot of the example application from the issue, which is now working correctly: Plus a few other configurations which are working correctly as before: |
| for (double scale = 1.0; scale <= 4.0; scale += 1.0) { | ||
| final TestCanvas canvas = new TestCanvas(<Invocation>[]); | ||
|
|
||
| final Rect outputRect = Rect.fromLTWH(30.0, 30.0, 250.0, 250.0); |
There was a problem hiding this comment.
nit: Please use new for a few more days while we await having a lint to remove all news at once. (We want to be consistent in the meantime.)
|
This looks great. Thanks for your contribution! If you could make the tiny fix mentioned, we can land it! Thanks! |
|
@Hixie |
|
@Hixie This has been here for a while. Can you merge it? I'm afraid that if you deicide to remove all |
|
Yup! Sorry about the delay! |
|
(Just need to wait for the tree to be green. Looks like we've had some bad commits recently.) |
|
Thanks for your contribution! |


Fixes #18682.
paintImageis used to paintBoxDecorationbackground images andImagewidgets. This PR adds a newscaleparameter so that the method can take into account the image scale (how many image pixels equal one logical pixel) so that 2.0x/3.0x variants are rendered correctly.