Index: Source/platform/graphics/filters/FEMorphology.cpp |
diff --git a/Source/platform/graphics/filters/FEMorphology.cpp b/Source/platform/graphics/filters/FEMorphology.cpp |
index f5d77963f6243cf140c31c194d06d24628c8f699..bfd2ebcbd11039b4b8abfd40bf56f3243fd7954a 100644 |
--- a/Source/platform/graphics/filters/FEMorphology.cpp |
+++ b/Source/platform/graphics/filters/FEMorphology.cpp |
@@ -35,8 +35,8 @@ namespace blink { |
FEMorphology::FEMorphology(Filter* filter, MorphologyOperatorType type, float radiusX, float radiusY) |
: FilterEffect(filter) |
, m_type(type) |
- , m_radiusX(radiusX) |
- , m_radiusY(radiusY) |
+ , m_radiusX(std::max(0.0f, radiusX)) |
+ , m_radiusY(std::max(0.0f, radiusY)) |
{ |
} |
@@ -65,6 +65,7 @@ float FEMorphology::radiusX() const |
bool FEMorphology::setRadiusX(float radiusX) |
{ |
+ radiusX = std::max(0.0f, radiusX); |
if (m_radiusX == radiusX) |
return false; |
m_radiusX = radiusX; |
@@ -76,22 +77,23 @@ float FEMorphology::radiusY() const |
return m_radiusY; |
} |
-FloatRect FEMorphology::mapRect(const FloatRect& rect, bool) |
-{ |
- FloatRect result = rect; |
- result.inflateX(filter()->applyHorizontalScale(m_radiusX)); |
- result.inflateY(filter()->applyVerticalScale(m_radiusY)); |
- return result; |
-} |
- |
bool FEMorphology::setRadiusY(float radiusY) |
{ |
+ radiusY = std::max(0.0f, radiusY); |
if (m_radiusY == radiusY) |
return false; |
m_radiusY = radiusY; |
return true; |
} |
+FloatRect FEMorphology::mapRect(const FloatRect& rect, bool) |
+{ |
+ FloatRect result = rect; |
+ result.inflateX(filter()->applyHorizontalScale(m_radiusX)); |
+ result.inflateY(filter()->applyVerticalScale(m_radiusY)); |
+ return result; |
+} |
+ |
PassRefPtr<SkImageFilter> FEMorphology::createImageFilter(SkiaImageFilterBuilder* builder) |
{ |
RefPtr<SkImageFilter> input(builder->build(inputEffect(0), operatingColorSpace())); |