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

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

Issue 89283002: Merge two determineFilterPrimitiveSubregion implementations (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix final nit Created 7 years, 1 month 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/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;
}
« no previous file with comments | « Source/core/platform/graphics/filters/FilterEffect.h ('k') | Source/core/rendering/FilterEffectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698