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

Unified Diff: third_party/WebKit/Source/core/style/FilterOperation.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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/filters/FEDropShadow.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/style/FilterOperation.cpp
diff --git a/third_party/WebKit/Source/core/style/FilterOperation.cpp b/third_party/WebKit/Source/core/style/FilterOperation.cpp
index a12dcb7285cb26d06cede13a01a442d088fd43e6..6308d7038524d54066c603caa56efdd43355da27 100644
--- a/third_party/WebKit/Source/core/style/FilterOperation.cpp
+++ b/third_party/WebKit/Source/core/style/FilterOperation.cpp
@@ -27,24 +27,13 @@
#include "platform/LengthFunctions.h"
#include "platform/animation/AnimationUtilities.h"
+#include "platform/graphics/filters/FEDropShadow.h"
#include "platform/graphics/filters/FEGaussianBlur.h"
#include "platform/graphics/filters/Filter.h"
#include "platform/graphics/filters/FilterEffect.h"
-#include "platform/graphics/filters/SkiaImageFilterBuilder.h"
namespace blink {
-static inline FloatSize outsetSizeForBlur(float stdDeviation) {
- IntSize kernelSize = FEGaussianBlur::calculateUnscaledKernelSize(
- FloatPoint(stdDeviation, stdDeviation));
- FloatSize outset;
- // We take the half kernel size and multiply it with three, because we run box
- // blur three times.
- outset.setWidth(3.0f * kernelSize.width() * 0.5f);
- outset.setHeight(3.0f * kernelSize.height() * 0.5f);
- return outset;
-}
-
FilterOperation* FilterOperation::blend(const FilterOperation* from,
const FilterOperation* to,
double progress) {
@@ -146,13 +135,8 @@ FilterOperation* BasicComponentTransferFilterOperation::blend(
}
FloatRect BlurFilterOperation::mapRect(const FloatRect& rect) const {
- // Matches FEGaussianBlur::mapRect.
float stdDeviation = floatValueForLength(m_stdDeviation, 0);
- FloatSize outsetSize = outsetSizeForBlur(stdDeviation);
- FloatRect mappedRect = rect;
- mappedRect.inflateX(outsetSize.width());
- mappedRect.inflateY(outsetSize.height());
- return mappedRect;
+ return FEGaussianBlur::mapEffect(FloatSize(stdDeviation, stdDeviation), rect);
}
FilterOperation* BlurFilterOperation::blend(const FilterOperation* from,
@@ -168,13 +152,9 @@ FilterOperation* BlurFilterOperation::blend(const FilterOperation* from,
}
FloatRect DropShadowFilterOperation::mapRect(const FloatRect& rect) const {
- FloatSize outsetSize = outsetSizeForBlur(m_stdDeviation);
- FloatRect mappedRect = rect;
- mappedRect.inflateX(outsetSize.width());
- mappedRect.inflateY(outsetSize.height());
- mappedRect.moveBy(m_location);
- mappedRect.unite(rect);
- return mappedRect;
+ float stdDeviation = m_stdDeviation;
+ return FEDropShadow::mapEffect(FloatSize(stdDeviation, stdDeviation),
+ FloatPoint(m_location), rect);
}
FilterOperation* DropShadowFilterOperation::blend(const FilterOperation* from,
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/filters/FEDropShadow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698