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

Commit 499477a

Browse files
committed
revert changes to solid_rrect_blur_contents
1 parent 2700c11 commit 499477a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

impeller/entity/contents/solid_rrect_blur_contents.cc

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <optional>
77

88
#include "impeller/entity/contents/content_context.h"
9-
#include "impeller/entity/contents/filters/gaussian_blur_filter_contents.h"
109
#include "impeller/entity/entity.h"
1110
#include "impeller/geometry/color.h"
1211
#include "impeller/geometry/constants.h"
@@ -49,19 +48,13 @@ Color SolidRRectBlurContents::GetColor() const {
4948
return color_;
5049
}
5150

52-
namespace {
53-
Scalar ScaleSigma(Scalar sigma) {
54-
return GaussianBlurFilterContents::ScaleSigma(sigma);
55-
}
56-
} // namespace
57-
5851
std::optional<Rect> SolidRRectBlurContents::GetCoverage(
5952
const Entity& entity) const {
6053
if (!rect_.has_value()) {
6154
return std::nullopt;
6255
}
6356

64-
Scalar radius = PadForSigma(ScaleSigma(sigma_.sigma));
57+
Scalar radius = PadForSigma(sigma_.sigma);
6558

6659
return rect_->Expand(radius).TransformBounds(entity.GetTransform());
6760
}
@@ -78,7 +71,10 @@ bool SolidRRectBlurContents::Render(const ContentContext& renderer,
7871

7972
VertexBufferBuilder<VS::PerVertexData> vtx_builder;
8073

81-
auto blur_sigma = ScaleSigma(sigma_.sigma);
74+
// Clamp the max kernel width/height to 1000 to limit the extent
75+
// of the blur and to kEhCloseEnough to prevent NaN calculations
76+
// trying to evaluate a Guassian distribution with a sigma of 0.
77+
auto blur_sigma = std::clamp(sigma_.sigma, kEhCloseEnough, 250.0f);
8278
// Increase quality by making the radius a bit bigger than the typical
8379
// sigma->radius conversion we use for slower blurs.
8480
auto blur_radius = PadForSigma(blur_sigma);

0 commit comments

Comments
 (0)