Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Unified Diff: Source/platform/graphics/filters/FEMorphology.cpp

Issue 1344283004: Update handling of negative radius for feMorphology (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGFEMorphologyElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()));
« no previous file with comments | « Source/core/svg/SVGFEMorphologyElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698