-
Notifications
You must be signed in to change notification settings - Fork 6k
Implement basic Picture.toImage via BitmapCanvas #13391
Conversation
| /// rasterized the first time the image is drawn and then cached. | ||
| Future<Image> toImage(int width, int height) => null; | ||
| Future<Image> toImage(int width, int height) async { | ||
| final engine.BitmapCanvas canvas = engine.BitmapCanvas(Rect.fromLTRB(0, 0, width.toDouble(), height.toDouble())); |
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.
Is this supposed to return the full contents of the canvas, resized to width x height? Or is it supposed to clip the canvas contents? It looks like this may clip the canvas contents since the BitmapCanvas you create may not be big enough to hold the contents of the recording canvas.
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.
Spoke offline. It seems like width and height are supposed to be the bounds of the canvas that the picture is drawn into.
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.
It will clip. I updated the docs.
git@github.com:flutter/engine.git/compare/c3b63d610b07...49971e2 git log c3b63d6..49971e2 --no-merges --oneline 2019-10-28 yjbanov@google.com Implement basic Picture.toImage via BitmapCanvas (flutter/engine#13391) 2019-10-28 chinmaygarde@google.com Switch the MacOS Desktop embedder to using a thread configuration where the platform and render task runners are the same. (flutter/engine#13300) 2019-10-28 skia-flutter-autoroll@skia.org Roll src/third_party/skia 18f5b1a6dd77..1beb8ae9a2f5 (9 commits) (flutter/engine#13392) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC aaclarke@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
git@github.com:flutter/engine.git/compare/c3b63d610b07...49971e2 git log c3b63d6..49971e2 --no-merges --oneline 2019-10-28 yjbanov@google.com Implement basic Picture.toImage via BitmapCanvas (flutter/engine#13391) 2019-10-28 chinmaygarde@google.com Switch the MacOS Desktop embedder to using a thread configuration where the platform and render task runners are the same. (flutter/engine#13300) 2019-10-28 skia-flutter-autoroll@skia.org Roll src/third_party/skia 18f5b1a6dd77..1beb8ae9a2f5 (9 commits) (flutter/engine#13392) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC aaclarke@google.com on the revert to ensure that a human is aware of the problem. To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
Even though this may not be terribly useful in real apps (at least until we learn to render all text on
BitmapCanvas) it is useful in some framework unit-tests.