Index: Source/core/platform/graphics/filters/FilterEffect.cpp |
diff --git a/Source/core/platform/graphics/filters/FilterEffect.cpp b/Source/core/platform/graphics/filters/FilterEffect.cpp |
index d69f0447d9b45d00dabf22d74d002b2f384132e9..9a525a5f8e4ccf0640394346c62ab989b8228cc0 100644 |
--- a/Source/core/platform/graphics/filters/FilterEffect.cpp |
+++ b/Source/core/platform/graphics/filters/FilterEffect.cpp |
@@ -437,16 +437,16 @@ TextStream& FilterEffect::externalRepresentation(TextStream& ts, int) const |
return ts; |
} |
-FloatRect FilterEffect::determineFilterPrimitiveSubregion() |
+FloatRect FilterEffect::determineFilterPrimitiveSubregion(DetermineSubregionFlags flags) |
{ |
ASSERT(filter()); |
// FETile, FETurbulence, FEFlood don't have input effects, take the filter region as unite rect. |
FloatRect subregion; |
if (unsigned numberOfInputEffects = inputEffects().size()) { |
- subregion = inputEffect(0)->determineFilterPrimitiveSubregion(); |
+ subregion = inputEffect(0)->determineFilterPrimitiveSubregion(flags); |
for (unsigned i = 1; i < numberOfInputEffects; ++i) |
- subregion.unite(inputEffect(i)->determineFilterPrimitiveSubregion()); |
+ subregion.unite(inputEffect(i)->determineFilterPrimitiveSubregion(flags)); |
} else |
subregion = filter()->filterRegion(); |
@@ -454,7 +454,8 @@ FloatRect FilterEffect::determineFilterPrimitiveSubregion() |
if (filterEffectType() == FilterEffectTypeTile) |
subregion = filter()->filterRegion(); |
- subregion = mapRect(subregion); |
+ if (flags & MapRectForward) |
+ subregion = mapRect(subregion); |
FloatRect boundaries = effectBoundaries(); |
if (hasX()) |
@@ -472,6 +473,13 @@ FloatRect FilterEffect::determineFilterPrimitiveSubregion() |
FloatSize filterResolution = filter()->filterResolution(); |
absoluteSubregion.scale(filterResolution.width(), filterResolution.height()); |
+ // Clip every filter effect to the filter region. |
+ if (flags & ClipToFilterRegion) { |
+ FloatRect absoluteScaledFilterRegion = filter()->absoluteFilterRegion(); |
+ absoluteScaledFilterRegion.scale(filterResolution.width(), filterResolution.height()); |
+ absoluteSubregion.intersect(absoluteScaledFilterRegion); |
+ } |
+ |
setMaxEffectRect(absoluteSubregion); |
return subregion; |
} |