Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Add rects to accumulator rather than bounds #37435

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

iskakaushik
Copy link
Contributor

When the accumulator is an RTreeBoundsAccumulator rather than a RectBoundsAccumulator just accumulating the bounds results in incorrect results as the rtree would need to be aware of the constituent non-overlapping rectangles. This would work fine for RectBoundsAccumulator as it would just adjust its bounds based on the passed rects.

Fixes: flutter/flutter#113251

When the accumulator is an `RTreeBoundsAccumulator` rather than a `RectBoundsAccumulator` just accumulating the bounds results in incorrect results as the `rtree` would need to be aware of the constituent non-overlapping rectangles. This would work fine for `RectBoundsAccumulator` as it would just adjust its bounds based on the passed rects.

Fixes: flutter/flutter#113251
@iskakaushik iskakaushik requested review from jmagman and flar November 8, 2022 18:04
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@iskakaushik iskakaushik added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 8, 2022
@auto-submit auto-submit bot merged commit 306b0fe into flutter:main Nov 8, 2022
@iskakaushik iskakaushik changed the title Add rects to accumulator rather than bounds [Impeller] Add rects to accumulator rather than bounds Nov 8, 2022
@iskakaushik iskakaushik self-assigned this Nov 8, 2022
@jmagman
Copy link
Member

jmagman commented Nov 8, 2022

It looks like this pull request may not have tests.

flutter/cocoon#2294

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

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

I would have submitted this review with "request changes", but it is too late as someone else already approved it.

@@ -672,7 +672,12 @@ void DisplayListBoundsCalculator::drawPicture(const sk_sp<SkPicture> picture,
}
void DisplayListBoundsCalculator::drawDisplayList(
const sk_sp<DisplayList> display_list) {
AccumulateOpBounds(display_list->bounds(), kDrawDisplayListFlags);
const SkRect bounds = display_list->bounds();
std::list<SkRect> rects =
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an expensive operation that must now be done on any bounds calculation whether or not it is attempting to accumulate an RTree. This option must be conditional.

std::list<SkRect> rects =
display_list->rtree()->searchNonOverlappingDrawnRects(bounds);
for (const SkRect& rect : rects) {
AccumulateOpBounds(rect, kDrawDisplayListFlags);
Copy link
Contributor

Choose a reason for hiding this comment

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

The use of kDrawDisplayListFlags here is problematic as it isn't clear if the attributes assigned to an entire display list apply to each individual rectangle.

For now, we don't apply any attributes, but in the future we might apply attributes and they can't necessarily be distributed like that. So, this works presently, but is a potential logic time bomb. Minimally a comment should be added to mention this discrepancy.

@jmagman
Copy link
Member

jmagman commented Nov 8, 2022

@iskakaushik sounds like this needs a revert to address @flar's concerns?

@iskakaushik
Copy link
Contributor Author

yup, reverting now

iskakaushik added a commit to iskakaushik/engine that referenced this pull request Nov 8, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 8, 2022
iskakaushik added a commit to iskakaushik/engine that referenced this pull request Nov 8, 2022
When the accumulator is an `RTreeBoundsAccumulator` rather than a `RectBoundsAccumulator` just accumulating the bounds results in incorrect results as the `rtree` would need to be aware of the constituent non-overlapping rectangles. This would work fine for `RectBoundsAccumulator` as it would just adjust its bounds based on the passed rects.

Fixes: flutter/flutter#113251
iskakaushik added a commit to iskakaushik/engine that referenced this pull request Nov 8, 2022
When the accumulator is an `RTreeBoundsAccumulator` rather than a `RectBoundsAccumulator` just accumulating the bounds results in incorrect results as the `rtree` would need to be aware of the constituent non-overlapping rectangles. This would work fine for `RectBoundsAccumulator` as it would just adjust its bounds based on the passed rects.

Fixes: flutter/flutter#113251
iskakaushik added a commit that referenced this pull request Nov 8, 2022
iskakaushik added a commit to iskakaushik/engine that referenced this pull request Nov 8, 2022
When the accumulator is an `RTreeBoundsAccumulator` rather than a `RectBoundsAccumulator` just accumulating the bounds results in incorrect results as the `rtree` would need to be aware of the constituent non-overlapping rectangles. This would work fine for `RectBoundsAccumulator` as it would just adjust its bounds based on the passed rects.

Fixes: flutter/flutter#113251
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 9, 2022
auto-submit bot pushed a commit that referenced this pull request Nov 9, 2022
* [Reland] Add rects to accumulator rather than bounds (#37435)

When the accumulator is an `RTreeBoundsAccumulator` rather than a `RectBoundsAccumulator` just accumulating the bounds results in incorrect results as the `rtree` would need to be aware of the constituent non-overlapping rectangles. This would work fine for `RectBoundsAccumulator` as it would just adjust its bounds based on the passed rects.

Fixes: flutter/flutter#113251

* Add a test for nested display list rtree
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 9, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 9, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 9, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 9, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 9, 2022
iskakaushik added a commit to iskakaushik/engine that referenced this pull request Nov 9, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 9, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 9, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 9, 2022
naudzghebre pushed a commit to naudzghebre/engine that referenced this pull request Nov 9, 2022
When the accumulator is an `RTreeBoundsAccumulator` rather than a `RectBoundsAccumulator` just accumulating the bounds results in incorrect results as the `rtree` would need to be aware of the constituent non-overlapping rectangles. This would work fine for `RectBoundsAccumulator` as it would just adjust its bounds based on the passed rects.

Fixes: flutter/flutter#113251
naudzghebre pushed a commit to naudzghebre/engine that referenced this pull request Nov 9, 2022
naudzghebre pushed a commit to naudzghebre/engine that referenced this pull request Nov 9, 2022
…lutter#37451)

* [Reland] Add rects to accumulator rather than bounds (flutter#37435)

When the accumulator is an `RTreeBoundsAccumulator` rather than a `RectBoundsAccumulator` just accumulating the bounds results in incorrect results as the `rtree` would need to be aware of the constituent non-overlapping rectangles. This would work fine for `RectBoundsAccumulator` as it would just adjust its bounds based on the passed rects.

Fixes: flutter/flutter#113251

* Add a test for nested display list rtree
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 9, 2022
zanderso pushed a commit to flutter/flutter that referenced this pull request Nov 9, 2022
…115008)

* de0b58e82 clang-tidy: added the ability to shard jobs (flutter/engine#37265)

* 8aefb8b61 Roll Dart SDK from d97d5ad98893 to b22b36c0f52e (1 revision) (flutter/engine#37400)

* 2f043090f Roll Skia from aef6d301c0b5 to 0c8127b3dd7d (6 revisions) (flutter/engine#37402)

* dc7cb20ad Fix boolean json property. (flutter/engine#37403)

* 512fa40b6 Adding release_build:true property to windows builders. (flutter/engine#37397)

* 0af87071f Add test for image readback (flutter/engine#37401)

* c6f26e035 Update display_list_image_filter_unittests to be permit Skia roll (flutter/engine#37327)

* 4e9e97b4b Roll Skia from 0c8127b3dd7d to 8b19fb0f57d4 (1 revision) (flutter/engine#37409)

* 42c2940ff Pass the correct name for gclient variables in ci.yaml (flutter/engine#37429)

* 2e2a2fd97 Revert "Roll Skia from 0c8127b3dd7d to 8b19fb0f57d4 (1 revision) (#37409)" (flutter/engine#37430)

* 02cb78905 Roll Fuchsia Mac SDK from sa5bVGimNo3JwLV27... to d4l6A1aPw6Z0YjxmA... (flutter/engine#37432)

* c24ae1872 [web] Use v8BreakIterator where possible (flutter/engine#37317)

* 306b0fe9c Add rects to accumulator rather than bounds (flutter/engine#37435)

* c76035429 Roll Dart SDK from b22b36c0f52e to c15cdb978761 (2 revisions) (flutter/engine#37437)
schwa423 pushed a commit to schwa423/engine that referenced this pull request Nov 16, 2022
When the accumulator is an `RTreeBoundsAccumulator` rather than a `RectBoundsAccumulator` just accumulating the bounds results in incorrect results as the `rtree` would need to be aware of the constituent non-overlapping rectangles. This would work fine for `RectBoundsAccumulator` as it would just adjust its bounds based on the passed rects.

Fixes: flutter/flutter#113251
schwa423 pushed a commit to schwa423/engine that referenced this pull request Nov 16, 2022
schwa423 pushed a commit to schwa423/engine that referenced this pull request Nov 16, 2022
…lutter#37451)

* [Reland] Add rects to accumulator rather than bounds (flutter#37435)

When the accumulator is an `RTreeBoundsAccumulator` rather than a `RectBoundsAccumulator` just accumulating the bounds results in incorrect results as the `rtree` would need to be aware of the constituent non-overlapping rectangles. This would work fine for `RectBoundsAccumulator` as it would just adjust its bounds based on the passed rects.

Fixes: flutter/flutter#113251

* Add a test for nested display list rtree
shogohida pushed a commit to shogohida/flutter that referenced this pull request Dec 7, 2022
…lutter#115008)

* de0b58e82 clang-tidy: added the ability to shard jobs (flutter/engine#37265)

* 8aefb8b61 Roll Dart SDK from d97d5ad98893 to b22b36c0f52e (1 revision) (flutter/engine#37400)

* 2f043090f Roll Skia from aef6d301c0b5 to 0c8127b3dd7d (6 revisions) (flutter/engine#37402)

* dc7cb20ad Fix boolean json property. (flutter/engine#37403)

* 512fa40b6 Adding release_build:true property to windows builders. (flutter/engine#37397)

* 0af87071f Add test for image readback (flutter/engine#37401)

* c6f26e035 Update display_list_image_filter_unittests to be permit Skia roll (flutter/engine#37327)

* 4e9e97b4b Roll Skia from 0c8127b3dd7d to 8b19fb0f57d4 (1 revision) (flutter/engine#37409)

* 42c2940ff Pass the correct name for gclient variables in ci.yaml (flutter/engine#37429)

* 2e2a2fd97 Revert "Roll Skia from 0c8127b3dd7d to 8b19fb0f57d4 (1 revision) (flutter#37409)" (flutter/engine#37430)

* 02cb78905 Roll Fuchsia Mac SDK from sa5bVGimNo3JwLV27... to d4l6A1aPw6Z0YjxmA... (flutter/engine#37432)

* c24ae1872 [web] Use v8BreakIterator where possible (flutter/engine#37317)

* 306b0fe9c Add rects to accumulator rather than bounds (flutter/engine#37435)

* c76035429 Roll Dart SDK from b22b36c0f52e to c15cdb978761 (2 revisions) (flutter/engine#37437)
gspencergoog pushed a commit to gspencergoog/flutter that referenced this pull request Jan 19, 2023
…lutter#115008)

* de0b58e82 clang-tidy: added the ability to shard jobs (flutter/engine#37265)

* 8aefb8b61 Roll Dart SDK from d97d5ad98893 to b22b36c0f52e (1 revision) (flutter/engine#37400)

* 2f043090f Roll Skia from aef6d301c0b5 to 0c8127b3dd7d (6 revisions) (flutter/engine#37402)

* dc7cb20ad Fix boolean json property. (flutter/engine#37403)

* 512fa40b6 Adding release_build:true property to windows builders. (flutter/engine#37397)

* 0af87071f Add test for image readback (flutter/engine#37401)

* c6f26e035 Update display_list_image_filter_unittests to be permit Skia roll (flutter/engine#37327)

* 4e9e97b4b Roll Skia from 0c8127b3dd7d to 8b19fb0f57d4 (1 revision) (flutter/engine#37409)

* 42c2940ff Pass the correct name for gclient variables in ci.yaml (flutter/engine#37429)

* 2e2a2fd97 Revert "Roll Skia from 0c8127b3dd7d to 8b19fb0f57d4 (1 revision) (flutter#37409)" (flutter/engine#37430)

* 02cb78905 Roll Fuchsia Mac SDK from sa5bVGimNo3JwLV27... to d4l6A1aPw6Z0YjxmA... (flutter/engine#37432)

* c24ae1872 [web] Use v8BreakIterator where possible (flutter/engine#37317)

* 306b0fe9c Add rects to accumulator rather than bounds (flutter/engine#37435)

* c76035429 Roll Dart SDK from b22b36c0f52e to c15cdb978761 (2 revisions) (flutter/engine#37437)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller needs tests
Projects
None yet
3 participants