-
Notifications
You must be signed in to change notification settings - Fork 6k
add currentTransform/Clip methods to DL and ui.Canvas #33308
add currentTransform/Clip methods to DL and ui.Canvas #33308
Conversation
Some of the errors cannot be fixed until this framework PR is merged: flutter/flutter#103737 |
I've run into trouble in implementing the web version of this. I've only looked at the canvaskit path so far, but it looks like canvaskit does not provide the methods that return the clip bounds. Further investigation is required to proceed. |
594e2b9
to
e63f578
Compare
@yjbanov I've added the new methods to the web_ui canvas.dart, but they aren't implemented anywhere (waiting to see what havoc that makes with the tests). Right now canvasKit is missing the implementation of some of these methods so we can't implement them in the canvaskit back end. I think the HTML back end might keep a stack of this information so that it could probably implement them now, but I wasn't sure if implementing things like this on HTML but not CK would be appropriate. Skia has been notified that we need the new methods and I've filed https://bugs.chromium.org/p/chromium/issues/detail?id=1327776 |
Letting this sit until https://bugs.chromium.org/p/skia/issues/detail?id=13347 is implemented. |
1b78aec
to
9e6d51a
Compare
1da5b83
to
06efd18
Compare
display_list/display_list_builder.cc
Outdated
clip_op == SkClipOp::kIntersect // | ||
? Push<ClipIntersectRRectOp>(0, 1, rrect, is_aa) | ||
: Push<ClipDifferenceRRectOp>(0, 1, rrect, is_aa); | ||
if (clip_op == SkClipOp::kIntersect) { |
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.
nit: avoid == with enums.
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.
(and elsewhere)
SkM44 inverse; | ||
if (current_layer_->matrix.invert(&inverse)) { | ||
SkRect devBounds; | ||
current_layer_->clip_bounds.roundOut(&devBounds); |
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.
Why 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.
The clip_bounds are sub-pixel accurate, but the actual pixels touched will be rounded out to a whole pixel which means any rendering op that touches any of these pixels might leak through into the resulting rendering since we don't actually do geometric clipping, so they must be accounted for in the returned bounds for culling analysis and they must be accounted for before the inverse transform is applied in the next line.
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 w/ nit
Fixes flutter/flutter#103469