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

Unified Diff: third_party/WebKit/Source/platform/graphics/filters/FEDropShadow.cpp

Issue 2341923002: Harmonize FilterEffect::mapRect and mapPaintRect (Closed)
Patch Set: Rebase Created 4 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
Index: third_party/WebKit/Source/platform/graphics/filters/FEDropShadow.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/filters/FEDropShadow.cpp b/third_party/WebKit/Source/platform/graphics/filters/FEDropShadow.cpp
index dbdd43680b411d5592c51a9dfc96ac5a9ece82c6..b2a99f79ac6bce2f2c205c676c34b00503bb19d6 100644
--- a/third_party/WebKit/Source/platform/graphics/filters/FEDropShadow.cpp
+++ b/third_party/WebKit/Source/platform/graphics/filters/FEDropShadow.cpp
@@ -44,22 +44,18 @@ FEDropShadow* FEDropShadow::create(Filter* filter, float stdX, float stdY, float
return new FEDropShadow(filter, stdX, stdY, dx, dy, shadowColor, shadowOpacity);
}
-FloatRect FEDropShadow::mapRect(const FloatRect& rect, bool forward) const
+FloatRect FEDropShadow::mapEffect(const FloatRect& rect) const
{
- FloatRect result = rect;
const Filter* filter = this->getFilter();
- ASSERT(filter);
+ DCHECK(filter);
FloatRect offsetRect = rect;
- if (forward)
- offsetRect.move(filter->applyHorizontalScale(m_dx), filter->applyVerticalScale(m_dy));
- else
- offsetRect.move(-filter->applyHorizontalScale(m_dx), -filter->applyVerticalScale(m_dy));
- result.unite(offsetRect);
+ offsetRect.move(filter->applyHorizontalScale(m_dx), filter->applyVerticalScale(m_dy));
IntSize kernelSize = FEGaussianBlur::calculateKernelSize(filter, FloatPoint(m_stdX, m_stdY));
// We take the half kernel size and multiply it with three, because we run box blur three times.
+ FloatRect result = unionRect(rect, offsetRect);
result.inflateX(3.0f * kernelSize.width() * 0.5f);
result.inflateY(3.0f * kernelSize.height() * 0.5f);
return result;
@@ -77,7 +73,6 @@ sk_sp<SkImageFilter> FEDropShadow::createImageFilter()
return SkDropShadowImageFilter::Make(SkFloatToScalar(dx), SkFloatToScalar(dy), SkFloatToScalar(stdX), SkFloatToScalar(stdY), color.rgb(), SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, std::move(input), &cropRect);
}
-
TextStream& FEDropShadow::externalRepresentation(TextStream& ts, int indent) const
{
writeIndent(ts, indent);

Powered by Google App Engine
This is Rietveld 408576698