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

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

Issue 2341923002: Harmonize FilterEffect::mapRect and mapPaintRect (Closed)
Patch Set: Baselines 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
Index: third_party/WebKit/Source/platform/graphics/filters/FEComposite.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/filters/FEComposite.cpp b/third_party/WebKit/Source/platform/graphics/filters/FEComposite.cpp
index 2b663728d28bab97effb40bbd6d24233957db0ea..c8711cf8d8004b960c492b67e16e5ee4ff741b18 100644
--- a/third_party/WebKit/Source/platform/graphics/filters/FEComposite.cpp
+++ b/third_party/WebKit/Source/platform/graphics/filters/FEComposite.cpp
@@ -113,55 +113,39 @@ bool FEComposite::setK4(float k4)
return true;
}
-FloatRect FEComposite::determineAbsolutePaintRect(const FloatRect& originalRequestedRect) const
+bool FEComposite::affectsTransparentPixels() const
{
- FloatRect requestedRect = originalRequestedRect;
- if (clipsToBounds())
- requestedRect.intersect(absoluteBounds());
+ return k4() > 0;
pdr. 2016/09/16 18:29:18 Can you add a comment explaining this line? There
fs 2016/09/16 18:53:28 Sure.
fs 2016/09/16 20:16:21 Noticed that I should probably have checked m_type
+}
- // No mapPaintRect required for FEComposite.
- FloatRect input1Rect = inputEffect(1)->determineAbsolutePaintRect(requestedRect);
- FloatRect affectedRect;
+FloatRect FEComposite::mapInputs(const FloatRect& rect) const
+{
+ FloatRect input1Rect = inputEffect(1)->mapRect(rect);
switch (m_type) {
case FECOMPOSITE_OPERATOR_IN:
// 'in' has output only in the intersection of both inputs.
- affectedRect = intersection(input1Rect, inputEffect(0)->determineAbsolutePaintRect(input1Rect));
- break;
+ return intersection(input1Rect, inputEffect(0)->mapRect(input1Rect));
case FECOMPOSITE_OPERATOR_ATOP:
// 'atop' has output only in the extents of the second input.
- // Make sure first input knows where it needs to produce output.
- inputEffect(0)->determineAbsolutePaintRect(input1Rect);
- affectedRect = input1Rect;
- break;
+ return input1Rect;
case FECOMPOSITE_OPERATOR_ARITHMETIC:
- if (k4() > 0) {
- // Make sure first input knows where it needs to produce output.
- inputEffect(0)->determineAbsolutePaintRect(requestedRect);
- // Arithmetic with non-zero k4 may influnce the complete filter primitive
- // region. So we can't optimize the paint region here.
- affectedRect = requestedRect;
- break;
- }
+ // Arithmetic with non-zero k4 may influnce the complete filter primitive
pdr. 2016/09/16 18:29:18 Nit: "influence" If possible, can you add comment
fs 2016/09/16 18:53:28 I'll see if can express this in a not too verbose
fs 2016/09/16 20:16:21 Comments added.
+ // region.
+ if (k4() > 0)
+ return rect;
if (k2() <= 0) {
// Input 0 does not appear where input 1 is not present.
- FloatRect input0Rect = inputEffect(0)->determineAbsolutePaintRect(input1Rect);
- if (k3() > 0) {
- affectedRect = input1Rect;
- } else {
- // Just k1 is positive. Use intersection.
- affectedRect = intersection(input1Rect, input0Rect);
- }
- break;
+ if (k3() > 0)
+ return input1Rect;
+ // Just k1 is positive. Use intersection.
+ return intersection(input1Rect, inputEffect(0)->mapRect(input1Rect));
}
// else fall through to use union
default:
- // Take the union of both input effects.
- affectedRect = unionRect(input1Rect, inputEffect(0)->determineAbsolutePaintRect(requestedRect));
break;
}
-
- affectedRect.intersect(requestedRect);
- return affectedRect;
+ // Take the union of both input effects.
+ return unionRect(input1Rect, inputEffect(0)->mapRect(rect));
}
SkXfermode::Mode toXfermode(CompositeOperationType mode)

Powered by Google App Engine
This is Rietveld 408576698