Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Prev Previous commit
Next Next commit
removed fudge
  • Loading branch information
gaaclarke committed Mar 8, 2024
commit 81b2a3259500b637e759bfcbb32e1a5339e90508
5 changes: 1 addition & 4 deletions impeller/aiks/aiks_blur_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
// blurs.
////////////////////////////////////////////////////////////////////////////////

float fudge = 100;

namespace impeller {
namespace testing {

Expand Down Expand Up @@ -840,12 +838,11 @@ TEST_P(AiksTest, GaussianBlurStyleSolid) {
}

TEST_P(AiksTest, GaussianBlurStyleInnerTexture) {
Scalar sigma = 30;
auto callback = [&](AiksContext& renderer) -> std::optional<Picture> {
static Scalar sigma = 30;
if (AiksTest::ImGuiBegin("Controls", nullptr,
ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::SliderFloat("Sigma", &sigma, 0, 500);
ImGui::SliderFloat("Fudge", &fudge, 0, 100);
ImGui::End();
}
Canvas canvas;
Expand Down
10 changes: 6 additions & 4 deletions impeller/aiks/paint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
#include "impeller/entity/contents/color_source_contents.h"
#include "impeller/entity/contents/filters/color_filter_contents.h"
#include "impeller/entity/contents/filters/filter_contents.h"
#include "impeller/entity/contents/filters/gaussian_blur_filter_contents.h"
#include "impeller/entity/contents/solid_color_contents.h"
#include "impeller/entity/geometry/geometry.h"

extern float fudge;

namespace impeller {

/// A color matrix which inverts colors.
Expand Down Expand Up @@ -126,12 +125,15 @@ std::shared_ptr<Contents> Paint::WithColorFilter(
std::shared_ptr<FilterContents> Paint::MaskBlurDescriptor::CreateMaskBlur(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would defer to @bdero to review the mask blur implementation. Overall code looks reasonable to me.

std::shared_ptr<TextureContents> texture_contents,
const std::shared_ptr<ColorFilter>& color_filter) const {
Scalar expand_amount = GaussianBlurFilterContents::CalculateBlurRadius(
GaussianBlurFilterContents::ScaleSigma(sigma.sigma));
texture_contents->SetSourceRect(
texture_contents->GetSourceRect().Expand(fudge, fudge));
texture_contents->GetSourceRect().Expand(expand_amount, expand_amount));
auto mask = std::make_shared<SolidColorContents>();
mask->SetColor(Color::White());
std::optional<Rect> coverage = texture_contents->GetCoverage({});
texture_contents->SetDestinationRect(coverage.value().Expand(fudge, fudge));
texture_contents->SetDestinationRect(
coverage.value().Expand(expand_amount, expand_amount));
auto descriptor = texture_contents->GetSamplerDescriptor();
texture_contents->SetSamplerDescriptor(descriptor);
std::shared_ptr<Geometry> geometry = Geometry::MakeRect(coverage.value());
Expand Down