Bug 945655 - Reduce arithmetic combine filter output rect depending on the coefficients. r=roc, a=lsblakk
authorMarkus Stange <mstange@themasta.com>
Tue, 10 Dec 2013 14:50:41 +0100
changeset 175487 4268a977d5206324c44dbb9d5328144855220d7b
parent 175486 96bd2d5ba2e236df319596c12232c15df05ab07a
child 175488 96277064d324271b19f78b9efe14f3cddcb89da7
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lsblakk
bugs945655
milestone28.0a2
Bug 945655 - Reduce arithmetic combine filter output rect depending on the coefficients. r=roc, a=lsblakk
gfx/2d/FilterNodeSoftware.cpp
--- a/gfx/2d/FilterNodeSoftware.cpp
+++ b/gfx/2d/FilterNodeSoftware.cpp
@@ -2566,18 +2566,32 @@ FilterNodeArithmeticCombineSoftware::Req
 {
   RequestInputRect(IN_ARITHMETIC_COMBINE_IN, aRect);
   RequestInputRect(IN_ARITHMETIC_COMBINE_IN2, aRect);
 }
 
 IntRect
 FilterNodeArithmeticCombineSoftware::GetOutputRectInRect(const IntRect& aRect)
 {
-  return GetInputRectInRect(IN_ARITHMETIC_COMBINE_IN, aRect).Union(
-    GetInputRectInRect(IN_ARITHMETIC_COMBINE_IN2, aRect)).Intersect(aRect);
+  if (mK4 > 0.0f) {
+    return aRect;
+  }
+  IntRect rectFrom1 = GetInputRectInRect(IN_ARITHMETIC_COMBINE_IN, aRect).Intersect(aRect);
+  IntRect rectFrom2 = GetInputRectInRect(IN_ARITHMETIC_COMBINE_IN2, aRect).Intersect(aRect);
+  IntRect result;
+  if (mK1 > 0.0f) {
+    result = rectFrom1.Intersect(rectFrom2);
+  }
+  if (mK2 > 0.0f) {
+    result = result.Union(rectFrom1);
+  }
+  if (mK3 > 0.0f) {
+    result = result.Union(rectFrom2);
+  }
+  return result;
 }
 
 FilterNodeCompositeSoftware::FilterNodeCompositeSoftware()
  : mOperator(COMPOSITE_OPERATOR_OVER)
 {}
 
 int32_t
 FilterNodeCompositeSoftware::InputIndex(uint32_t aInputEnumIndex)