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

Commit bd3a0c3

Browse files
committed
removed fudge
1 parent 85e7d4e commit bd3a0c3

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
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

15-
extern float fudge;
16-
1716
namespace impeller {
1817

1918
/// A color matrix which inverts colors.
@@ -126,12 +125,15 @@ std::shared_ptr<Contents> Paint::WithColorFilter(
126125
std::shared_ptr<FilterContents> Paint::MaskBlurDescriptor::CreateMaskBlur(
127126
std::shared_ptr<TextureContents> texture_contents,
128127
const std::shared_ptr<ColorFilter>& color_filter) const {
128+
Scalar expand_amount = GaussianBlurFilterContents::CalculateBlurRadius(
129+
GaussianBlurFilterContents::ScaleSigma(sigma.sigma));
129130
texture_contents->SetSourceRect(
130-
texture_contents->GetSourceRect().Expand(fudge, fudge));
131+
texture_contents->GetSourceRect().Expand(expand_amount, expand_amount));
131132
auto mask = std::make_shared<SolidColorContents>();
132133
mask->SetColor(Color::White());
133134
std::optional<Rect> coverage = texture_contents->GetCoverage({});
134-
texture_contents->SetDestinationRect(coverage.value().Expand(fudge, fudge));
135+
texture_contents->SetDestinationRect(
136+
coverage.value().Expand(expand_amount, expand_amount));
135137
auto descriptor = texture_contents->GetSamplerDescriptor();
136138
texture_contents->SetSamplerDescriptor(descriptor);
137139
std::shared_ptr<Geometry> geometry = Geometry::MakeRect(coverage.value());

0 commit comments

Comments
 (0)