From 452d6cf304ece0ecfe94f1371c5151e2376673de Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Wed, 15 Jul 2009 14:08:57 -0400 Subject: [PATCH] Bug 501428. SMIL: Optimize nsSMILKeySpline::CalcBezier. r=dholbert, r=longsonr Eliminates the call to pow() and reduces the number of multiplications from 4 to 3. --- content/smil/nsSMILKeySpline.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/smil/nsSMILKeySpline.cpp b/content/smil/nsSMILKeySpline.cpp index 2579a8a953e..0cee12bc7e6 100644 --- a/content/smil/nsSMILKeySpline.cpp +++ b/content/smil/nsSMILKeySpline.cpp @@ -78,7 +78,8 @@ nsSMILKeySpline::CalcBezier(double aT, double aA1, double aA2) { - return A(aA1, aA2) * pow(aT,3) + B(aA1, aA2)*aT*aT + C(aA1) * aT; + // use Horner's scheme to evaluate the Bezier polynomial + return ((A(aA1, aA2)*aT + B(aA1, aA2))*aT + C(aA1))*aT; } /*static*/ double