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

Commit 09bbeba

Browse files
committed
removed fudge
1 parent 85e7d4e commit 09bbeba

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

impeller/aiks/aiks_blur_unittests.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
// blurs.
1717
////////////////////////////////////////////////////////////////////////////////
1818

19-
float fudge = 100;
20-
2119
namespace impeller {
2220
namespace testing {
2321

@@ -673,12 +671,11 @@ TEST_P(AiksTest, GaussianBlurStyleSolid) {
673671
}
674672

675673
TEST_P(AiksTest, GaussianBlurStyleInnerTexture) {
674+
Scalar sigma = 30;
676675
auto callback = [&](AiksContext& renderer) -> std::optional<Picture> {
677-
static Scalar sigma = 30;
678676
if (AiksTest::ImGuiBegin("Controls", nullptr,
679677
ImGuiWindowFlags_AlwaysAutoResize)) {
680678
ImGui::SliderFloat("Sigma", &sigma, 0, 500);
681-
ImGui::SliderFloat("Fudge", &fudge, 0, 100);
682679
ImGui::End();
683680
}
684681
Canvas canvas;

impeller/aiks/paint.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "impeller/entity/contents/color_source_contents.h"
1010
#include "impeller/entity/contents/filters/color_filter_contents.h"
1111
#include "impeller/entity/contents/filters/filter_contents.h"
12+
#include "impeller/entity/contents/filters/gaussian_blur_filter_contents.h"
1213
#include "impeller/entity/contents/solid_color_contents.h"
1314
#include "impeller/entity/geometry/geometry.h"
1415

@@ -126,12 +127,15 @@ std::shared_ptr<Contents> Paint::WithColorFilter(
126127
std::shared_ptr<FilterContents> Paint::MaskBlurDescriptor::CreateMaskBlur(
127128
std::shared_ptr<TextureContents> texture_contents,
128129
const std::shared_ptr<ColorFilter>& color_filter) const {
130+
Scalar expand_amount = GaussianBlurFilterContents::CalculateBlurRadius(
131+
GaussianBlurFilterContents::ScaleSigma(sigma.sigma));
129132
texture_contents->SetSourceRect(
130-
texture_contents->GetSourceRect().Expand(fudge, fudge));
133+
texture_contents->GetSourceRect().Expand(expand_amount, expand_amount));
131134
auto mask = std::make_shared<SolidColorContents>();
132135
mask->SetColor(Color::White());
133136
std::optional<Rect> coverage = texture_contents->GetCoverage({});
134-
texture_contents->SetDestinationRect(coverage.value().Expand(fudge, fudge));
137+
texture_contents->SetDestinationRect(
138+
coverage.value().Expand(expand_amount, expand_amount));
135139
auto descriptor = texture_contents->GetSamplerDescriptor();
136140
texture_contents->SetSamplerDescriptor(descriptor);
137141
std::shared_ptr<Geometry> geometry = Geometry::MakeRect(coverage.value());

0 commit comments

Comments
 (0)