mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1325487 - Improve SVGContentUtils::ComputeNormalizedHypotenuse and use it more r=dholbert
This commit is contained in:
parent
7173b111bb
commit
89c77adf8e
@ -21,6 +21,7 @@
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsMathUtils.h"
|
||||
#include "SVGAnimationElement.h"
|
||||
#include "SVGAnimatedPreserveAspectRatio.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -509,7 +510,7 @@ SVGContentUtils::RectilinearGetStrokeBounds(const Rect& aRect,
|
||||
double
|
||||
SVGContentUtils::ComputeNormalizedHypotenuse(double aWidth, double aHeight)
|
||||
{
|
||||
return sqrt((aWidth*aWidth + aHeight*aHeight)/2);
|
||||
return NS_hypot(aWidth, aHeight) / M_SQRT2;
|
||||
}
|
||||
|
||||
float
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsMathUtils.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsSVGElement.h"
|
||||
@ -154,8 +153,9 @@ nsCSSClipPathInstance::CreateClipPathCircle(DrawTarget* aDrawTarget,
|
||||
} else {
|
||||
// We resolve percent <shape-radius> value for circle() as defined here:
|
||||
// https://drafts.csswg.org/css-shapes/#funcdef-circle
|
||||
const double sqrt2 = std::sqrt(2.0);
|
||||
double referenceLength = NS_hypot(aRefBox.width, aRefBox.height) / sqrt2;
|
||||
double referenceLength =
|
||||
SVGContentUtils::ComputeNormalizedHypotenuse(aRefBox.width,
|
||||
aRefBox.height);
|
||||
r = nsRuleNode::ComputeCoordPercentCalc(coords[0],
|
||||
NSToCoordRound(referenceLength));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user