Visitar URL original
Default clipBehavior of ClipRect to hardEdge. by GaryQian · Pull Request #21703 · flutter/flutter · GitHub
Skip to content

Default clipBehavior of ClipRect to hardEdge. - #21703

Merged
GaryQian merged 2 commits into
flutter:masterfrom
GaryQian:cliprectaa
Sep 13, 2018
Merged

GaryQian merged 2 commits into
flutter:masterfrom
GaryQian:cliprectaa

Conversation

@GaryQian

@GaryQian GaryQian commented Sep 11, 2018 •

Copy link
Copy Markdown
Contributor

Using antiAlias in ClipRect, which is no longer the default, is now slow since flutter-team-archive/engine#6199 enables AA.

Background:
Previously, the engine did not properly pass the AA flag on ClipRect.clipBehavior. flutter-team-archive/engine#6199 fixes this and enables AA. However, default AA on clipRects has caused severe regressions in benchmark performance.

To maintain expected performance, we should now default the clipBehavior to hardEdge to disable default AA. This is consistent with any flutter projects that did not previously explicitly set the clipBehavior and should not change app appearance.

Migration:

  • If you left clipBehavior as default: Nothing!
  • If you explicitly set clipBehavior as hardEdge: Nothing!
  • If you explicitly set clipBehavior as antiAlias or antiAliasWithSaveLayer: Your application will now actually perform the specified AA. It is up to you to decide if the performance is worth the visual improvement.
  • If you left clipBehavior as default and expected AA: explicitly set clipBehavior to Clip.antiAlias and verify that the performance is acceptable to your application.

For the most part, there should be minimal if any need to migrate code, but I will be glad to assist anyone to achieve the expected clipping behavior.

Summary:
clipBehavior is now properly respected instead of always hardEdge. Any expectation of anti-aliasing should be re-evaluated in regards to performance.

#21702

@GaryQian GaryQian self-assigned this Sep 11, 2018
@GaryQian

GaryQian commented Sep 11, 2018 •

Copy link
Copy Markdown
Contributor Author

Fixes: #21617 (Benchmarks regressing)
and #21702 (Direct issue)

GaryQian added a commit to flutter-team-archive/goldens that referenced this pull request Sep 11, 2018

@liyuqian liyuqian left a comment

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.

LGTM. Thanks for the quick fix!

@Hixie

Hixie commented Sep 11, 2018

Copy link
Copy Markdown
Contributor

LGTM, but please make sure to add more documentation soon. Thanks!

@goderbauer

Copy link
Copy Markdown
Member

FYI: My golden files update for an engine roll overwrite your golden update for this PR, see flutter-team-archive/goldens#17.

GaryQian added a commit to flutter-team-archive/goldens that referenced this pull request Sep 12, 2018
@liyuqian

Copy link
Copy Markdown
Contributor

FYI: you can also git rebase master and git push -f to avoid the Merge branch master commit.

@Hixie

Hixie commented Sep 13, 2018

Copy link
Copy Markdown
Contributor

This seems to have had no effect on the regression.

@GaryQian
GaryQian deleted the cliprectaa branch November 29, 2018 01:21
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 8, 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.

6 participants