-
-
Notifications
You must be signed in to change notification settings - Fork 934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Do not render SVGs bigger than requested when pixelRatio > 1 and no match in _imageCache #2795
Conversation
Screen.Recording.2023-10-04.at.14.10.29.movDragging a mouse with left button pressed allows resizing that circle. During the movement, SVG is repeatedly rendered with different sizes, so the rendering is done by the "else" branch of |
…atch in _imageCache
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, lgtm!
@spydon I checked rendering the same SVG with many different sizes (after all, that is how I found this bug) and my "svg circle" was always where it was expected - on top of circle drawn with |
Yeah, I think it is indeed wrong! |
Now I'm actually wondering where does that change in goldens come from. Previously the bottom hand was perfectly below the top one, now it's below and a bit to the left. I don't see anything in svg_test.dart test "render sharply" that should be moving the hand horizontally - no paddings, margins or whatever... any idea? |
Oh true, the original was correct then... |
…quested size proportions
…quested size proportions
824b401
to
de985b1
Compare
…atch in _imageCache
Now it is ready for merge right @l1553k? :) |
I think I understand what is really going on. And sometimes And yes, I think this is the final form :) |
Description
When rendering the SVG for the first time, on devices with pixelRatio > 1, the image is rendered bigger. Only subsequent renders that utilize
_imageCache
are rendering the SVG properly.Checklist
docs
and added dartdoc comments with///
.examples
ordocs
.Breaking Change?
Tested on screens with pixelRatio=1 (LG, 2560x1080) and =2 (MacBook Pro M1)