mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[Impeller] new blur: round downsample to power of two (flutter/engine#50245)
This makes the downsampling step of the new blur round to the nearest power of 2. This makes the changes in downsampling less frequent and the output of downsampling hypothetically higher quality since downsampling by a power of 2 is easier. issue: https://github.com/flutter/flutter/issues/141510 ## before https://github.com/flutter/engine/assets/30870216/73e78f02-1346-4dde-ad6e-8aaa7c910bac ## after https://github.com/flutter/engine/assets/30870216/b4153ada-6a82-4d0a-a4c2-158134c7b74f [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
parent
7c04b55f07
commit
ec74b5fbef
@ -207,7 +207,10 @@ Scalar GaussianBlurFilterContents::CalculateScale(Scalar sigma) {
|
||||
if (sigma <= 4) {
|
||||
return 1.0;
|
||||
}
|
||||
return 4.0 / sigma;
|
||||
Scalar result = 4.0 / sigma;
|
||||
// Round to the nearest 1/(2^n) to get the best quality down scaling.
|
||||
Scalar rounded = pow(2.0f, round(log2(result)));
|
||||
return rounded;
|
||||
};
|
||||
|
||||
std::optional<Rect> GaussianBlurFilterContents::GetFilterSourceCoverage(
|
||||
|
||||
@ -987,7 +987,8 @@ TEST_P(EntityTest, Filters) {
|
||||
}
|
||||
|
||||
TEST_P(EntityTest, GaussianBlurFilter) {
|
||||
auto boston = CreateTextureForFixture("boston.jpg");
|
||||
auto boston =
|
||||
CreateTextureForFixture("boston.jpg", /*enable_mipmapping=*/true);
|
||||
ASSERT_TRUE(boston);
|
||||
|
||||
auto callback = [&](ContentContext& context, RenderPass& pass) -> bool {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user