[gnome-system-monitor/gnome-3-12] Revert "Do not clear the load graph when switching to/from stacked" https://bugzilla.gnome.org/show_



commit 43e238bf06424e3cbbda24e0e6d5bc7eb52523d0
Author: Robert Roth <robert roth off gmail com>
Date:   Mon Apr 21 13:24:57 2014 +0300

    Revert "Do not clear the load graph when switching to/from stacked"
    https://bugzilla.gnome.org/show_bug.cgi?id=728644
    This reverts commit 5b2598f9edfb39f802ec45f4c839d2eba31b4b20.

 src/application.cpp |    1 +
 src/load-graph.cpp  |   11 ++++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/application.cpp b/src/application.cpp
index da24445..f9f299e 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -37,6 +37,7 @@ cb_draw_stacked_changed (GSettings *settings, const gchar *key, gpointer data)
 
     app->config.draw_stacked = g_settings_get_boolean(settings, key);
     app->cpu_graph->clear_background();
+    load_graph_reset(app->cpu_graph);
 }
 
 
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 7b79c3b..e06d5d4 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -276,6 +276,8 @@ load_graph_draw (GtkWidget *widget,
         }
         if (drawStacked) {
             cairo_rel_line_to (cr, 0, graph->real_draw_height + 3.5f);
+            //cairo_stroke_preserve(cr);
+            //cairo_close_path(cr);
             cairo_fill(cr);
         } else {
             cairo_stroke (cr);
@@ -320,6 +322,7 @@ get_load (LoadGraph *graph)
     // that value has no meaning, we just want all the
     // graphs to be aligned, so the CPU graph needs to start
     // immediately
+    bool drawStacked = graph->type == LOAD_GRAPH_CPU && GsmApplication::get()->config.draw_stacked;
 
     for (i = 0; i < graph->n; i++) {
         float load;
@@ -331,9 +334,11 @@ get_load (LoadGraph *graph)
 
         load = used / MAX(total, 1.0f);
         graph->data[0][i] = load;
-        graph->data[0][i] /= graph->n;
-        if (i > 0) {
-            graph->data[0][i] += graph->data[0][i-1];
+        if (drawStacked) {
+            graph->data[0][i] /= graph->n;
+            if (i > 0) {
+                graph->data[0][i] += graph->data[0][i-1];
+            }
         }
 
         /* Update label */


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