diff --git a/layout/reftests/svg/radialGradient-basic-03-ref.svg b/layout/reftests/svg/radialGradient-basic-03-ref.svg new file mode 100644 index 000000000000..aabc31d420ce --- /dev/null +++ b/layout/reftests/svg/radialGradient-basic-03-ref.svg @@ -0,0 +1,34 @@ + + + + Reference for gradient + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/layout/reftests/svg/radialGradient-basic-03.svg b/layout/reftests/svg/radialGradient-basic-03.svg new file mode 100644 index 000000000000..8d2add380816 --- /dev/null +++ b/layout/reftests/svg/radialGradient-basic-03.svg @@ -0,0 +1,34 @@ + + + + Testcase for gradient + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/layout/reftests/svg/reftest.list b/layout/reftests/svg/reftest.list index b09fc4ab7d16..a2f811a4a8bd 100644 --- a/layout/reftests/svg/reftest.list +++ b/layout/reftests/svg/reftest.list @@ -81,6 +81,7 @@ random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == opacity-and-gradient-01.svg pass.svg == pseudo-classes-02.svg pseudo-classes-02-ref.svg == radialGradient-basic-01.svg pass.svg == radialGradient-basic-02.svg pass.svg +== radialGradient-basic-03.svg radialGradient-basic-03-ref.svg == rect-01.svg pass.svg == rect-with-rx-and-ry-01.svg pass.svg == rect-with-rx-or-ry-01.svg rect-with-rx-or-ry-01-ref.svg diff --git a/layout/svg/base/src/nsSVGGradientFrame.cpp b/layout/svg/base/src/nsSVGGradientFrame.cpp index 8803f624d0e9..6cf9c8108926 100644 --- a/layout/svg/base/src/nsSVGGradientFrame.cpp +++ b/layout/svg/base/src/nsSVGGradientFrame.cpp @@ -563,11 +563,14 @@ nsSVGRadialGradientFrame::CreateGradient() // The focal point (fFx and fFy) must be clamped to be *inside* - not on - // the circumference of the gradient or we'll get rendering anomalies. We // calculate the distance from the focal point to the gradient center and - // make sure it is *less* than the gradient radius. 0.999 is used as the + // make sure it is *less* than the gradient radius. 0.99 is used as the // factor of the radius because it's close enough to 1 that we won't get a // fringe at the edge of the gradient if we clamp, but not so close to 1 // that rounding error will give us the same results as using fR itself. - double dMax = 0.999 * r; + // Also note that .99 < 255/256/2 which is the limit of the fractional part + // of cairo's 24.8 fixed point representation divided by 2 to ensure that + // we get different cairo fractions + double dMax = 0.99 * r; float dx = fx - cx; float dy = fy - cy; double d = sqrt((dx * dx) + (dy * dy));