Bug 368840 - Ensure gradients without stops are transparent rather than the fallback colour. r+sr=tor,a1.9=mtschrep

This commit is contained in:
longsonr@gmail.com 2008-02-08 13:52:04 -08:00
parent b4a426f21e
commit babfdc0aaa
2 changed files with 13 additions and 9 deletions

View File

@ -328,19 +328,21 @@ nsSVGGradientFrame::SetupPaintServer(gfxContext *aContext,
nsSVGGeometryFrame *aSource,
float aGraphicOpacity)
{
PRUint32 nStops = GetStopCount();
// SVG specification says that no stops should be treated like
// the corresponding fill or stroke had "none" specified.
if (nStops == 0)
return PR_FALSE;
// Get the transform list (if there is one)
gfxMatrix patternMatrix = GetGradientTransform(aSource);
if (patternMatrix.IsSingular())
return PR_FALSE;
PRUint32 nStops = GetStopCount();
// SVG specification says that no stops should be treated like
// the corresponding fill or stroke had "none" specified.
if (nStops == 0) {
aContext->SetColor(gfxRGBA(0, 0, 0, 0));
return PR_TRUE;
}
patternMatrix.Invert();
nsRefPtr<gfxPattern> gradient = CreateGradient();

View File

@ -835,8 +835,10 @@ nsSVGPatternFrame::SetupPaintServer(gfxContext *aContext,
nsSVGGeometryFrame *aSource,
float aGraphicOpacity)
{
if (aGraphicOpacity == 0.0f)
return PR_FALSE;
if (aGraphicOpacity == 0.0f) {
aContext->SetColor(gfxRGBA(0, 0, 0, 0));
return PR_TRUE;
}
gfxMatrix matrix = aContext->CurrentMatrix();