mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 573687 - Clamp radial gradients with small radii correctly. r=jwatt
This commit is contained in:
parent
fd471e0e0a
commit
5a4ce6bb1f
@ -25,10 +25,15 @@
|
||||
<stop offset="0" stop-color="lime" />
|
||||
<stop offset="1" stop-color="red"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="gradient5" r="0.2" fx="0.308">
|
||||
<stop offset="0" stop-color="lime" />
|
||||
<stop offset="1" stop-color="red"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
<circle cx="100" cy="100" r="50" fill="url(#gradient1)"/>
|
||||
<circle cx="100" cy="200" r="50" fill="url(#gradient2)"/>
|
||||
<circle cx="200" cy="100" r="50" fill="url(#gradient3)"/>
|
||||
<circle cx="200" cy="200" r="50" fill="url(#gradient4)"/>
|
||||
<circle cx="300" cy="100" r="50" fill="url(#gradient5)"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.5 KiB |
@ -25,10 +25,15 @@
|
||||
<stop offset="0" stop-color="lime" />
|
||||
<stop offset="1" stop-color="red"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="gradient5" r="0.2" fx="0.3">
|
||||
<stop offset="0" stop-color="lime" />
|
||||
<stop offset="1" stop-color="red"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
<circle cx="100" cy="100" r="50" fill="url(#gradient1)"/>
|
||||
<circle cx="100" cy="200" r="50" fill="url(#gradient2)"/>
|
||||
<circle cx="200" cy="100" r="50" fill="url(#gradient3)"/>
|
||||
<circle cx="200" cy="200" r="50" fill="url(#gradient4)"/>
|
||||
<circle cx="300" cy="100" r="50" fill="url(#gradient5)"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.5 KiB |
@ -587,14 +587,11 @@ 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.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.
|
||||
// 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;
|
||||
// make sure it is *less* than the gradient radius.
|
||||
// 1/128 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 = NS_MAX(0.0, r - 1.0/128);
|
||||
float dx = fx - cx;
|
||||
float dy = fy - cy;
|
||||
double d = sqrt((dx * dx) + (dy * dy));
|
||||
|
Loading…
Reference in New Issue
Block a user