-
Notifications
You must be signed in to change notification settings - Fork 6k
Ensure raster cache doesn't bleed over to adjacent physical pixels #35602
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
flow/raster_cache.cc
Outdated
| canvas.save(); | ||
| // Make sure raster cache doesn't bleed to physical pixels outside of original | ||
| // bounds. https://github.com/flutter/flutter/issues/110002 | ||
| canvas.clipRect(SkRect::Make(bounds.roundOut())); |
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.
Adding a clip here is going to be expensive in aggregate, especially if it is only needed for low DPR devices. Is there another way to do this?
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.
The clip is hard edge on pixel boundaries. Is it that expensive? Not sure what you mean by low DPR. The example shows artifacts on 2x iPhone, but I'd assume it will happen on 3x device as well.
I think we might be able to determine situation where the bleeding can't happen i.e. (bounds.fLeft + imageWidth) <= ceil(bounds.fRight)
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.
I changed the code to only clip if raster image actually exceeds original pixel boundaries. This should remove the clip in vast majority of cases. Still working on tests for this.
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.
Another possible approach would be to shrink the src and destination rect for the drawImage by replacing it with drawImageRect. lets consider that if we land this and performance degrades, but otherwise a simple check should be good.
bd9dd2a to
2644346
Compare
jonahwilliams
left a comment
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.
LGTM
Fixes flutter/flutter#110002
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.