Bug 619967 - Resolve percentage filter primitive attributes correctly. r=roc

This commit is contained in:
Robert Longson 2012-01-09 13:18:53 +11:00
parent 970ebd503e
commit 0c4e2bbd70

View File

@ -43,11 +43,6 @@
#include "nsLayoutUtils.h"
#include "gfxUtils.h"
static double Square(double aX)
{
return aX*aX;
}
float
nsSVGFilterInstance::GetPrimitiveNumber(PRUint8 aCtxType, float aValue) const
{
@ -69,9 +64,9 @@ nsSVGFilterInstance::GetPrimitiveNumber(PRUint8 aCtxType, float aValue) const
return value * mFilterSpaceSize.height / mFilterRect.Height();
case nsSVGUtils::XY:
default:
return value *
sqrt(Square(mFilterSpaceSize.width) + Square(mFilterSpaceSize.height)) /
sqrt(Square(mFilterRect.Width()) + Square(mFilterRect.Height()));
return value * nsSVGUtils::ComputeNormalizedHypotenuse(
mFilterSpaceSize.width / mFilterRect.Width(),
mFilterSpaceSize.height / mFilterRect.Height());
}
}