on xenial help sign in
Fixed black colour on the first of the month due to division. Fixes: https://bugs.launchpad.net/bugs/1233657.

Approved by PS Jenkins bot, Pete Woods.

commita96385ba80d94fe2507720c098d056695b60420c authorNicolas d'Offay <nicolas.doffay@canonical.com> dateWed 2 Oct 2013, 05:49 (13 years ago) parent16fd5bf9ff170c
1 file changed+7−3
Greeter/Gradient.js+7−3
Greeter/Gradient.js+7−3
@@ -15,8 +15,12 @@
1515 */
1616
1717function threeColorByIndex(index, total, colors) {
18− var red, green, blue
19− var p = index / total
18+ var red, green, blue;
19+ var p = 0.0;
20+
21+ if(total > 0) {
22+ p = index / total;
23+ }
2024
2125 if (p < 0.5) {
2226 red = (colors.main.r * p * 2.0) + colors.start.r * (0.5 - p) * 2.0;
@@ -28,5 +32,5 @@ function threeColorByIndex(index, total, colors) {
2832 blue = colors.end.b * (p - 0.5) * 2.0 + colors.main.b * (1.0 - p) * 2.0;
2933 }
3034
31− return Qt.rgba(red, green, blue, 1)
35+ return Qt.rgba(red, green, blue, 1);
3236}