Skip to content

Make Layer.toImage() accept bounds rather than size - #17129

Merged
tvolkert merged 2 commits into
flutter:masterfrom
tvolkert:toimage
Apr 30, 2018
Merged

tvolkert merged 2 commits into
flutter:masterfrom
tvolkert:toimage

Conversation

@tvolkert

Copy link
Copy Markdown
Contributor

It allows callers to account for things like shadows that paint
outside the bounds of the widget.

#16859

It allows callers to account for things like shadows that paint
outside the bounds of the widget.

#16859
@tvolkert

Copy link
Copy Markdown
Contributor Author

This includes #17126

/// The returned [ui.Image] has uncompressed raw RGBA bytes, in the
/// dimensions [logicalSize] multiplied by the [pixelRatio].
/// The returned [ui.Image] has uncompressed raw RGBA bytes, will be offset
/// by [bounds.topLeft], and have dimensions of [bounds.size] multiplied by

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately dartdoc won't like this

transform.translate(-offset.dx, -offset.dy, 0.0);
final Matrix4 transform = new Matrix4.identity();
transform.translate(bounds.left, bounds.top);
transform.translate(-offset.dx, -offset.dy);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in theory you could save a couple of cycles by merging these calls

@Hixie

Hixie commented Apr 30, 2018

Copy link
Copy Markdown
Contributor

you accidentally added a binary file to the PR


@override
Rect get paintBounds => Offset.zero & size;
Rect get paintBounds => Offset.zero & (size * configuration.devicePixelRatio);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should unit test this change to make sure we don't regress it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Hixie

Hixie commented Apr 30, 2018

Copy link
Copy Markdown
Contributor

LGTM modulo comments

* Added test of RenderView.paintBounds
* Optimized matrix math in Layer.toImage()
* Remove accidentally checked-in binary
* Fixed dartdoc comments
@tvolkert

Copy link
Copy Markdown
Contributor Author

All other comments addressed - merging on green

@tvolkert

Copy link
Copy Markdown
Contributor Author

Merging on red due to flakes (pub flake and #17137)

@tvolkert
tvolkert merged commit b2c67e8 into flutter:master Apr 30, 2018
@tvolkert
tvolkert deleted the toimage branch April 30, 2018 22:26
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
It allows callers to account for things like shadows that paint
outside the bounds of the widget.

flutter#16859
@andreidiaconu

Copy link
Copy Markdown
Contributor

I think this issue might be related #17686

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants