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

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

Issue 2319293004: Replace FilterEffect::maxEffectRect() with absoluteBounds() (Closed)
Patch Set: Add comment Created 4 years, 3 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 | « third_party/WebKit/Source/platform/graphics/filters/FilterEffect.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp b/third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp
index f294d5fe205729ad6effa62d6b1d6d453552ad3c..ca28865cf218340e852d52d760653ea66891362a 100644
--- a/third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp
+++ b/third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp
@@ -48,12 +48,20 @@ DEFINE_TRACE(FilterEffect)
visitor->trace(m_filter);
}
+FloatRect FilterEffect::absoluteBounds() const
+{
+ FloatRect computedBounds = getFilter()->filterRegion();
+ if (!filterPrimitiveSubregion().isEmpty())
+ computedBounds.intersect(filterPrimitiveSubregion());
+ return getFilter()->mapLocalRectToAbsoluteRect(computedBounds);
+}
+
FloatRect FilterEffect::determineAbsolutePaintRect(const FloatRect& originalRequestedRect)
{
FloatRect requestedRect = originalRequestedRect;
// Filters in SVG clip to primitive subregion, while CSS doesn't.
- if (m_clipsToBounds)
- requestedRect.intersect(maxEffectRect());
+ if (clipsToBounds())
+ requestedRect.intersect(absoluteBounds());
// We may be called multiple times if result is used more than once. Return
// quickly if if nothing new is required.
@@ -127,42 +135,6 @@ TextStream& FilterEffect::externalRepresentation(TextStream& ts, int) const
return ts;
}
-FloatRect FilterEffect::determineMaximumEffectRect()
-{
- DCHECK(getFilter());
- Filter* filter = getFilter();
-
- // Compute the union of the inputs. Always do this because it has
- // side-effects. (It computes the maximum effect rect of the input.)
- FloatRect absoluteInputUnion;
- for (auto& effect : m_inputEffects)
- absoluteInputUnion.unite(effect->determineMaximumEffectRect());
-
- FloatRect absoluteSubregion;
- switch (getFilterEffectType()) {
- default:
- if (m_inputEffects.size()) {
- absoluteSubregion = absoluteInputUnion;
- if (clipsToBounds())
- absoluteSubregion.intersect(filter->mapLocalRectToAbsoluteRect(filterPrimitiveSubregion()));
- break;
- }
- // Else fall-through and use the primitive region. (FETurbulence/FEFlood/FEImage)
- case FilterEffectTypeTile:
- absoluteSubregion = filter->mapLocalRectToAbsoluteRect(filterPrimitiveSubregion());
- break;
- case FilterEffectTypeSourceInput:
- absoluteSubregion = filter->absoluteFilterRegion();
- break;
- }
-
- // Clip every filter effect to the filter region.
- absoluteSubregion.intersect(filter->absoluteFilterRegion());
-
- m_maxEffectRect = absoluteSubregion;
- return absoluteSubregion;
-}
-
sk_sp<SkImageFilter> FilterEffect::createImageFilter()
{
return nullptr;
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/filters/FilterEffect.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698