-
Notifications
You must be signed in to change notification settings - Fork 28.7k
remove single-view assumption from paintImage
#117495
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
Conversation
paintImage
bdc3e83
to
c394485
Compare
@dnfield A while ago you added this code to Another option would be to make passing in the dpr required. This would be a breaking change since there are two callers of this method in google3 (those could be easily updated, though). It does feel a little odd to require it just for the debug check, though. Yet another option could be to move the check out of paintImage. However, I didn't really find a better place for it... What are your thoughts? |
@@ -424,6 +424,10 @@ void debugFlushLastFrameImageSizeInfo() { | |||
/// | |||
/// * `image`: The image to paint onto the canvas. | |||
/// | |||
/// * `devicePixelRatio`: The device pixel ratio of the [FlutterView] into | |||
/// which the image will be drawn. Can be obtained via | |||
/// `View.of(context).devicePixelRation`. |
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.
note to self: mention MediaQuery.devicePixelRatioOf(context)
as well
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.
/// `View.of(context).devicePixelRation`. | |
/// `View.of(context).devicePixelRatio`. |
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.
Can this get defaulted somehow?
For example, just default it to the first view in the collection of views?
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.
If we default this, the assert check in paintImage
becomes more or less meaningless, no? It needs to know the exact dpr in order to figure out whether the current image dimensions are overkill or not.
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.
We could just use the max device pixel ratio of all views as an upper bound, though. That will greatly simplify things.
@@ -5980,6 +5981,7 @@ class RawImage extends LeafRenderObjectWidget { | |||
invertColors: invertColors, | |||
isAntiAlias: isAntiAlias, | |||
filterQuality: filterQuality, | |||
devicePixelRatio: View.maybeOf(context)?.devicePixelRatio, |
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.
note to self: here and below use MediaQuery.maybeDevicePixelRatioOf(context)
instead.
"Google testing" failed because tests were run without including prerequisite #117244. |
Superseded by #118721. |
Fixes #117477.
Part of #116929.