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

Unified Diff: Source/core/platform/graphics/filters/FEDropShadow.cpp

Issue 14652016: Implement filter primitive subregion for reference CSS filters. This required refactoring determin… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix test failures: ReferenceFilterOperation should ref the Filter which owns its FilterEffects Created 7 years, 7 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: Source/core/platform/graphics/filters/FEDropShadow.cpp
diff --git a/Source/core/platform/graphics/filters/FEDropShadow.cpp b/Source/core/platform/graphics/filters/FEDropShadow.cpp
index b0065aef2a2232ba5a7ffbed3e5f15ff377c5141..a2c5406aa8af17e68babf1d1d574724f49bb17c0 100644
--- a/Source/core/platform/graphics/filters/FEDropShadow.cpp
+++ b/Source/core/platform/graphics/filters/FEDropShadow.cpp
@@ -57,18 +57,7 @@ void FEDropShadow::determineAbsolutePaintRect()
Filter* filter = this->filter();
ASSERT(filter);
- FloatRect absolutePaintRect = inputEffect(0)->absolutePaintRect();
- FloatRect absoluteOffsetPaintRect(absolutePaintRect);
- absoluteOffsetPaintRect.move(filter->applyHorizontalScale(m_dx), filter->applyVerticalScale(m_dy));
- absolutePaintRect.unite(absoluteOffsetPaintRect);
-
- unsigned kernelSizeX = 0;
- unsigned kernelSizeY = 0;
- FEGaussianBlur::calculateKernelSize(filter, kernelSizeX, kernelSizeY, m_stdX, m_stdY);
-
- // We take the half kernel size and multiply it with three, because we run box blur three times.
- absolutePaintRect.inflateX(3 * kernelSizeX * 0.5f);
- absolutePaintRect.inflateY(3 * kernelSizeY * 0.5f);
+ FloatRect absolutePaintRect = mapRect(inputEffect(0)->absolutePaintRect());
if (clipsToBounds())
absolutePaintRect.intersect(maxEffectRect());
@@ -78,6 +67,29 @@ void FEDropShadow::determineAbsolutePaintRect()
setAbsolutePaintRect(enclosingIntRect(absolutePaintRect));
}
+FloatRect FEDropShadow::mapRect(const FloatRect& rect, bool forward)
+{
+ FloatRect result = rect;
+ Filter* filter = this->filter();
+ ASSERT(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);
+
+ unsigned kernelSizeX = 0;
+ unsigned kernelSizeY = 0;
+ FEGaussianBlur::calculateKernelSize(filter, kernelSizeX, kernelSizeY, m_stdX, m_stdY);
+
+ // We take the half kernel size and multiply it with three, because we run box blur three times.
+ result.inflateX(3 * kernelSizeX * 0.5f);
+ result.inflateY(3 * kernelSizeY * 0.5f);
+ return result;
+}
+
void FEDropShadow::applySoftware()
{
FilterEffect* in = inputEffect(0);
« no previous file with comments | « Source/core/platform/graphics/filters/FEDropShadow.h ('k') | Source/core/platform/graphics/filters/FEGaussianBlur.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698