mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1817826 - Fix rendering of reversed (clockwise) sweep gradients. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D173746
This commit is contained in:
parent
b2d2b75a5f
commit
2b5cfb7a38
@ -1218,10 +1218,10 @@ struct PaintSweepGradient : public PaintPatternBase {
|
||||
if (solidColor) {
|
||||
return solidColor;
|
||||
}
|
||||
// ConicGradientPattern works counterclockwise. If the gradient is defined
|
||||
// clockwise (with aStart greater than aEnd), we'll reverse the color line
|
||||
// and swap the start and end angles.
|
||||
bool reverse = aEnd < aStart;
|
||||
if (reverse) {
|
||||
std::swap(aStart, aEnd);
|
||||
}
|
||||
float firstStop, lastStop;
|
||||
RefPtr stops =
|
||||
aColorLine->MakeGradientStops(aState, &firstStop, &lastStop, reverse);
|
||||
@ -1239,6 +1239,9 @@ struct PaintSweepGradient : public PaintPatternBase {
|
||||
aEnd = aStart + sweep * (lastStop - firstStop);
|
||||
}
|
||||
}
|
||||
if (reverse) {
|
||||
std::swap(aStart, aEnd);
|
||||
}
|
||||
return MakeUnique<ConicGradientPattern>(aCenter, M_PI / 2.0, aStart / 2.0,
|
||||
aEnd / 2.0, std::move(stops),
|
||||
Matrix::Scaling(1.0, -1.0));
|
||||
|
Loading…
Reference in New Issue
Block a user