Skip to content

Commit e719b79

Browse files
authored
[Impeller] fixed subpass filter coverage with image filters (flutter#46431)
fixes: flutter#135777 fixes: flutter#135766 fixes: flutter#135212 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I signed the [CLA]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
1 parent 87c3bf1 commit e719b79

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

impeller/aiks/aiks_unittests.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3590,6 +3590,25 @@ TEST_P(AiksTest, ClearBlend) {
35903590
clear.blend_mode = BlendMode::kClear;
35913591

35923592
canvas.DrawCircle(Point::MakeXY(300.0, 300.0), 200.0, clear);
3593+
}
3594+
3595+
TEST_P(AiksTest, MatrixImageFilterMagnify) {
3596+
Canvas canvas;
3597+
canvas.Scale(GetContentScale());
3598+
auto image = std::make_shared<Image>(CreateTextureForFixture("airplane.jpg"));
3599+
canvas.Translate({600, -200});
3600+
canvas.SaveLayer({
3601+
.image_filter = std::make_shared<MatrixImageFilter>(
3602+
Matrix{
3603+
2, 0, 0, 0, //
3604+
0, 2, 0, 0, //
3605+
0, 0, 2, 0, //
3606+
0, 0, 0, 1 //
3607+
},
3608+
SamplerDescriptor{}),
3609+
});
3610+
canvas.DrawImage(image, {0, 0}, Paint{.color = Color(1.0, 1.0, 1.0, 0.5)});
3611+
canvas.Restore();
35933612

35943613
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
35953614
}

impeller/entity/entity_pass.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ std::optional<Rect> EntityPass::GetSubpassCoverage(
202202
// has deviated too much from the parent pass to safely intersect with the
203203
// pass coverage limit.
204204
coverage_limit =
205-
(image_filter && image_filter->IsTranslationOnly() ? std::nullopt
206-
: coverage_limit);
205+
(image_filter && !image_filter->IsTranslationOnly() ? std::nullopt
206+
: coverage_limit);
207207

208208
auto entities_coverage = subpass.GetElementsCoverage(coverage_limit);
209209
// The entities don't cover anything. There is nothing to do.

0 commit comments

Comments
 (0)