-
Notifications
You must be signed in to change notification settings - Fork 6k
Implement union and intersection for DlRegion #42620
Conversation
2b9835a
to
88f3a5a
Compare
5f09e78
to
5f7083c
Compare
Just a thought I wanted to pass along. A cursory inspection looks like this might be easy to do with the code as written. If you look at 2 regions and consider that their interaction can be broken down into 4 types of overlap:
Then you can write a general Op that takes 3 flags (AnotB, BnotA, Both) or a bitmask and can perform any number of operations for the same code cost and very very minimal performance overhead:
So you get 4 ops for the price of 1 (not that we have any immediate use for the other 3). (And, in terms of API, the flags would be an internal implementation detail - the API should take an enum, or different method names or something descriptive like that.) |
That seems similar to what SkRegion does to a degree, but I think it comes at a cost (union of regions is well optimized in SkRegion but is still slower). I can imagine doing this for span lines, but when it comes to processing actual spans in the line inside engine/display_list/geometry/dl_region.cc Lines 96 to 200 in 5f7083c
|
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'm not done reviewing all of the code, but reached a stopping point so I thought I would submit the review so far...
9cea138
to
5f3cc4b
Compare
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.
A few suggestions but also a potential bug in modifying an input region hidden in the union code.
c163a57
to
c8fe700
Compare
22491a3
to
aba9968
Compare
aba9968
to
f677106
Compare
Looks ready for another look cc @flar |
This comment was marked as outdated.
This comment was marked as outdated.
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.
Everything still looks good and the PR is still approved, just adding some clarification notes on my previous optional comments that might have been unclear.
9adc176
to
7bd2ae4
Compare
9cd9bf9
to
1df34ac
Compare
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.
As before, functionally it is already good to go, but some observations that might help with maintenance or performance to consider...
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
…129563) flutter/engine@debee7c...6358232 2023-06-26 [email protected] Roll ANGLE from 7169dc5fe003 to 764f31be3228 (1 revision) (flutter/engine#43199) 2023-06-26 [email protected] Roll Skia from 6d89bc1acb7e to 46dcf29e5dfe (2 revisions) (flutter/engine#43197) 2023-06-26 [email protected] Implement union and intersection for DlRegion (flutter/engine#42620) 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 [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose 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/+doc/main/autoroll/README.md
Fixes flutter/flutter#128412
Adds
DlRegion DlRegion::MakeUnion(const Region &, const DlRegion &)
DlRegion DlRegion::MakeIntersection(const Region &, const DlRegion &)
bool DlRegion::intersects(const DlRegion &)
bool DlRegion::intersects(const SkIRect &)
Instead of per span line vector all spans are stored in continuous buffer.
Complete benchmarks:
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.