[gnome-boxes] Really fix the white triangle in the graph



commit 4ed2e3d38c82f239df179746d9272bdfc197675d
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date:   Mon Feb 20 22:30:17 2012 +0100

    Really fix the white triangle in the graph
    
    When missing stats, we may compute NaN numbers, this results in
    incorrect graph.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=670359

 src/mini-graph.vala |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/mini-graph.vala b/src/mini-graph.vala
index 00f6442..275dbc6 100644
--- a/src/mini-graph.vala
+++ b/src/mini-graph.vala
@@ -57,8 +57,12 @@ private class Boxes.MiniGraph: Gtk.DrawingArea {
 
         var nstep = (npoints == -1 ? points.length : npoints) - 1;
         var ymax = ymax_set ? ymax : max ();
-        var dx = (double)width / nstep;
-        var dy = (double)height / ymax;
+        var dy = 0.0;
+        var dx = 0.0;
+        if (nstep != 0)
+            dx = (double)width / nstep;
+        if (ymax != 0)
+            dy = (double)height / ymax;
 
         var x = 0.0;
         foreach (var p in points) {
@@ -74,7 +78,6 @@ private class Boxes.MiniGraph: Gtk.DrawingArea {
 
         Gdk.cairo_set_source_rgba (cr, style.get_border_color (get_state_flags ()));
         x = 0.0;
-        cr.move_to (0.0, 0.0);
         foreach (var p in points) {
             var y = height - p * dy;
             if (x == 0.0)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]