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

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

Issue 2393993004: Consolidate FilterOperation and FilterEffect mapRect implementations (Closed)
Patch Set: Rebase; Drop stale comment. Created 4 years, 2 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 938fd18406ba0b756671ef57f36f06ad8cfe58f1..84148574ade7a50122cf122acc82530a371be056 100644
--- a/third_party/WebKit/Source/platform/graphics/filters/FEDropShadow.cpp
+++ b/third_party/WebKit/Source/platform/graphics/filters/FEDropShadow.cpp
@@ -54,23 +54,23 @@ FEDropShadow* FEDropShadow::create(Filter* filter,
shadowOpacity);
}
+FloatRect FEDropShadow::mapEffect(const FloatSize& stdDeviation,
+ const FloatPoint& offset,
+ const FloatRect& rect) {
+ FloatRect offsetRect = rect;
+ offsetRect.moveBy(offset);
+ FloatRect blurredRect = FEGaussianBlur::mapEffect(stdDeviation, offsetRect);
+ return unionRect(blurredRect, rect);
+}
+
FloatRect FEDropShadow::mapEffect(const FloatRect& rect) const {
const Filter* filter = this->getFilter();
DCHECK(filter);
-
- FloatRect offsetRect = rect;
- 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 by 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;
+ FloatPoint offset(filter->applyHorizontalScale(m_dx),
+ filter->applyVerticalScale(m_dy));
+ FloatSize stdError(filter->applyHorizontalScale(m_stdX),
+ filter->applyVerticalScale(m_stdY));
+ return mapEffect(stdError, offset, rect);
}
sk_sp<SkImageFilter> FEDropShadow::createImageFilter() {

Powered by Google App Engine
This is Rietveld 408576698