Commit 13ca247b authored by Christoffer Ackelman's avatar Christoffer Ackelman Committed by Esteban Blanc

QT: Fixed the gradient when filling an arc with a gradient.

parent 7e38756a
......@@ -2815,11 +2815,10 @@ int GlowDrawQt::gradient_fill_arc(GlowWind* wind, int x, int y, int w, int h,
return 1;
}
while (angle1 >= 360) {
angle1 -= 360;
}
while (angle1 < 360) {
angle1 += 360;
if (angle1 >= 360) {
angle1 = angle1 - angle1 / 360 * 360;
} else if (angle1 < 0) {
angle1 = angle1 + (-angle1 / 360 + 1) * 360;
}
unique_ptr<QPainter> painter = new QPainter(ww->buffer);
......@@ -2829,18 +2828,16 @@ int GlowDrawQt::gradient_fill_arc(GlowWind* wind, int x, int y, int w, int h,
}
QGradient* pat;
if (!gradient_create_pattern(-1, -1, 2, 2, d0, d1, d2, gradient, &pat)) {
if (!gradient_create_pattern(x, y, w, h, d0, d1, d2, gradient, &pat)) {
return 0;
}
painter->translate(x + w / 2.0, y + h / 2.0);
painter->scale(w / 2.0, h / 2.0);
QPainterPath path;
if (!(angle2 == 360 || angle2 == 180))
path.moveTo(0, 0);
path.arcTo(-1, -1, 2, 2, angle1, angle2);
path.moveTo(x + w / 2.0, y + h / 2.0);
path.arcTo(x, y, w, h, angle1, angle2);
if (!(angle2 == 360 || angle2 == 180))
path.moveTo(0, 0);
path.moveTo(x + w / 2.0, y + h / 2.0);
painter->fillPath(path, *pat);
delete pat;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment