Bug 310382 - follow svg rule for dealing with out-of-order stops. r=jwatt

This commit is contained in:
tor%cs.brown.edu 2005-09-30 19:19:46 +00:00
Родитель 86d6844b26
Коммит 819f0f556d
2 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -66,6 +66,8 @@ static void
CairoSetStops(cairo_pattern_t *aPattern, nsISVGGradient *aGrad)
{
PRUint32 nStops;
float lastOffset = 0.0f;
aGrad->GetStopCount(&nStops);
for (PRUint32 i = 0; i < nStops; i++) {
nscolor rgba;
@ -76,6 +78,11 @@ CairoSetStops(cairo_pattern_t *aPattern, nsISVGGradient *aGrad)
aGrad->GetStopColor(i, &rgba);
aGrad->GetStopOpacity(i, &opacity);
if (offset < lastOffset)
offset = lastOffset;
else
lastOffset = offset;
cairo_pattern_add_color_stop_rgba(aPattern, offset,
NS_GET_R(rgba)/255.0,
NS_GET_G(rgba)/255.0,

Просмотреть файл

@ -111,6 +111,8 @@ GDIPlusGetStops(nsISVGGradient *aGrad, Color **aColors, REAL **aPositions,
if (offset < lastOffset)
offset = lastOffset;
else
lastOffset = offset;
(*aColors)[idx].SetValue(argb);
(*aPositions)[idx] = (REAL)offset;