Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] Make matrix image filter in saving layer work as expected #40171

Merged
merged 2 commits into from
Mar 15, 2023

Conversation

ColdPaleLight
Copy link
Member

@ColdPaleLight ColdPaleLight commented Mar 9, 2023

fix flutter/flutter#121893
fix flutter/flutter#120879

This PR tries to distinguish whether it is a subpass scene (aka. save layer) in MatrixImageFilterContents, and do different processing for subpass scenes.

without patch

6x6UAiK8Fk

with patch

vyWLtiMFW7

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@ColdPaleLight ColdPaleLight requested a review from bdero March 9, 2023 09:01
@ColdPaleLight ColdPaleLight self-assigned this Mar 9, 2023
Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

Thank you so much! Minor nits but lgtm otherwise.

impeller/entity/contents/filters/matrix_filter_contents.h Outdated Show resolved Hide resolved
impeller/entity/contents/filters/matrix_filter_contents.h Outdated Show resolved Hide resolved
@@ -93,7 +93,7 @@ std::optional<Entity> DirectionalMorphologyFilterContents::RenderFilter(
frame_info.texture_sampler_y_coord_scale =
input_snapshot->texture->GetYCoordScale();

auto transform = entity.GetTransformation() * effect_transform;
auto transform = entity.GetTransformation() * effect_transform.Basis();
Copy link
Member

Choose a reason for hiding this comment

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

The given effect transform should already have its translation/projective coords stripped. Can we remove the Basis() calls here and in the gaussian blur?

Copy link
Member Author

Choose a reason for hiding this comment

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

The given effect transform should already have its translation/projective coords stripped. Can we remove the Basis() calls here and in the gaussian blur?

I modified the implementation of FilterContents::SetEffectTransform, because MatrixImageFilter needs an original matrix instead of a stripped one, otherwise the result will be incorrect (such as when nesting Transformed widget). So I added Basis() to blur and morphology.

void FilterContents::SetEffectTransform(Matrix effect_transform) {
-  effect_transform_ = effect_transform.Basis();
+  effect_transform_ = effect_transform;
}

@ColdPaleLight ColdPaleLight added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 15, 2023
@auto-submit auto-submit bot merged commit 85354b5 into flutter:main Mar 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
No open projects
Archived in project
3 participants