From 931079671aa6e9a609b596226b53da3a2fd8f74e Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Tue, 10 Dec 2013 14:50:41 +0100 Subject: [PATCH] Bug 945655 - Reduce arithmetic combine filter output rect depending on the coefficients. r=roc --- gfx/2d/FilterNodeSoftware.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gfx/2d/FilterNodeSoftware.cpp b/gfx/2d/FilterNodeSoftware.cpp index 840bd719c35..7155e1e45ca 100644 --- a/gfx/2d/FilterNodeSoftware.cpp +++ b/gfx/2d/FilterNodeSoftware.cpp @@ -2571,8 +2571,22 @@ FilterNodeArithmeticCombineSoftware::RequestFromInputsForRect(const IntRect &aRe 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()