зеркало из https://github.com/mozilla/gecko-dev.git
Bug 310382 - follow svg rule for dealing with out-of-order stops. r=jwatt
This commit is contained in:
Родитель
86d6844b26
Коммит
819f0f556d
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче