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

Commit d0464cf

Browse files
authored
[Impeller] Turned on new blur. (#48472)
This new blur should perform faster since it scales down the image before blurring it. Jonah did early testing of it and found it to be faster. Scrolling around with the blur perf bug it seems faster. It also has a wider test bed and is hopefully easier to maintain since it contains all of its logic for both directions. testing: There are existing blur tests and we've backfilled more as we've added features to this blur. fixes flutter/flutter#131580 fixes flutter/flutter#138259 ## 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 6fa8e76 commit d0464cf

File tree

2 files changed

+7
-32
lines changed

2 files changed

+7
-32
lines changed

impeller/entity/contents/filters/directional_gaussian_blur_filter_contents.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ namespace impeller {
4343
/// - `FilterContents::MakeGaussianBlur`
4444
/// - //flutter/impeller/entity/shaders/gaussian_blur/gaussian_blur.glsl
4545
///
46+
///\deprecated Previously 2 of these were chained to do 2D blurs, use
47+
/// \ref GaussianBlurFilterContents instead since it has better
48+
/// performance.
4649
class DirectionalGaussianBlurFilterContents final : public FilterContents {
4750
public:
4851
DirectionalGaussianBlurFilterContents();

impeller/entity/contents/filters/filter_contents.cc

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -56,38 +56,10 @@ std::shared_ptr<FilterContents> FilterContents::MakeGaussianBlur(
5656
Sigma sigma_y,
5757
BlurStyle blur_style,
5858
Entity::TileMode tile_mode) {
59-
constexpr bool use_new_filter =
60-
#ifdef IMPELLER_ENABLE_NEW_GAUSSIAN_FILTER
61-
true;
62-
#else
63-
false;
64-
#endif
65-
66-
// TODO(https://github.com/flutter/flutter/issues/131580): Remove once the new
67-
// blur handles all cases.
68-
if (use_new_filter) {
69-
auto blur = std::make_shared<GaussianBlurFilterContents>(
70-
sigma_x.sigma, sigma_y.sigma, tile_mode);
71-
blur->SetInputs({input});
72-
return blur;
73-
}
74-
std::shared_ptr<FilterContents> x_blur = MakeDirectionalGaussianBlur(
75-
/*input=*/input,
76-
/*sigma=*/sigma_x,
77-
/*direction=*/Point(1, 0),
78-
/*blur_style=*/BlurStyle::kNormal,
79-
/*tile_mode=*/tile_mode,
80-
/*is_second_pass=*/false,
81-
/*secondary_sigma=*/{});
82-
std::shared_ptr<FilterContents> y_blur = MakeDirectionalGaussianBlur(
83-
/*input=*/FilterInput::Make(x_blur),
84-
/*sigma=*/sigma_y,
85-
/*direction=*/Point(0, 1),
86-
/*blur_style=*/blur_style,
87-
/*tile_mode=*/tile_mode,
88-
/*is_second_pass=*/true,
89-
/*secondary_sigma=*/sigma_x);
90-
return y_blur;
59+
auto blur = std::make_shared<GaussianBlurFilterContents>(
60+
sigma_x.sigma, sigma_y.sigma, tile_mode);
61+
blur->SetInputs({input});
62+
return blur;
9163
}
9264

9365
std::shared_ptr<FilterContents> FilterContents::MakeBorderMaskBlur(

0 commit comments

Comments
 (0)