-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] separate algorithm for computing render target size. #54604
Changes from 30 commits
9d59af1
a935594
7aa3a48
54cea5a
e6e56d8
98a5d68
81ccaa0
55a6a50
3591395
a8f0e2c
1c55cf5
a6f5f21
a646c1b
8daf291
199a846
b2eb6b9
d347783
24442e0
78b7f60
2a4ac2d
3eff88b
04b5be5
086abb8
4a5f30b
fa3afcc
4e7a707
e0105d7
e8f34ac
8a3d1ef
24ef59a
0cae7a8
ae57e62
bc2276e
b3ab833
334e5e9
82a6621
5011b3c
008b6f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -722,23 +722,10 @@ void DlDispatcherBase::saveLayer(const SkRect& bounds, | |
| auto promise = options.content_is_clipped() | ||
| ? ContentBoundsPromise::kMayClipContents | ||
| : ContentBoundsPromise::kContainsContents; | ||
| std::optional<Rect> impeller_bounds; | ||
| if (!options.content_is_unbounded() || options.bounds_from_caller()) { | ||
| impeller_bounds = skia_conversions::ToRect(bounds); | ||
| } | ||
|
|
||
| // Empty bounds on a save layer that contains a BDF or destructive blend | ||
| // should be treated as unbounded. All other empty bounds can be skipped. | ||
| if (impeller_bounds.has_value() && impeller_bounds->IsEmpty() && | ||
| (backdrop != nullptr || | ||
| Entity::IsBlendModeDestructive(paint.blend_mode))) { | ||
| impeller_bounds = std::nullopt; | ||
| } | ||
|
|
||
| std::optional<Rect> impeller_bounds = skia_conversions::ToRect(bounds); | ||
| GetCanvas().SaveLayer(paint, impeller_bounds, ToImageFilter(backdrop), | ||
| promise, total_content_depth, | ||
| options.can_distribute_opacity(), | ||
| options.bounds_from_caller()); | ||
| options.can_distribute_opacity()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you also need
The supplied bounds are still provided because the flag overrides them and we did calculate them, so why not, but they don't promise that the content of this SL is bounded if that flag is present. If there is unbounded child content, DL might substitute the clip at the moment that content is discovered - but only if that enclosing clip is inside the same DL/layer. If there has not yet been a restricting clip before we get to the unbounded content inside the SL, then the SL itself is marked unbounded via the options. So, there are 3 conditions that lead to unbounded contents.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The unbounded content should be handled in the line about where I replace the content bounds with std::nullopt: this doesn't solve the problem of impeller/dl speaking different terms of unbounded. Longer term, we should probably just plumb this flag through.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We handle that by only applying clear color on srcOver, but layer on that is the flood clip check in entity_pass
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The unbounded line was deleted. You are pointing to what the code "used to do"...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤦
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to think more about that. The unbounded is a reason to ignore the bounds, but I'm not sure that user supplied bounds are a reason to use them even in the unbounded case. Scratches head...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh right, we discussed this! That is why I deleted the line, but I need to add it back.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, removed bounds from caller. We just check if its unbounded.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agh, I think we hit this already. If a saveLayer contains unbounded content, but does not have a bdf or destructive blend, but the saveLayer was bounded - then bounds.is_clipped should be true and we don't null out the bds.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay so this is a case where maybe there is actually a DL misunderstanding. On the test ImageFilteredSaveLayerWithUnboundedContents we expect the content to be clipped via the saveLayer bounds. This saveLayer has a specified bounds of (0, 0, 200, 200) but I guess, its technically correct that this saveLayer, which contains a drawPaint, is unbounded - but we decided to treat is bounded so maybe content_is_unbounded should return false? |
||
| } | ||
|
|
||
| // |flutter::DlOpReceiver| | ||
|
|
||
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.
Should this also examine the paint.color_filter?
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 don't know that bit currently, but we will eventually: flutter/flutter#154035
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.
(once we delete impeller::ColorFilter)