[gnome-system-monitor] Do not create and destroy unnecessary cairo_t



commit a556118292a7b0ec96aeb3de1dc36086b5eeca1c
Author: Robert Roth <robert roth off gmail com>
Date:   Fri Jan 17 09:47:40 2014 +0200

    Do not create and destroy unnecessary cairo_t

 src/load-graph.cpp |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)
---
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 578766f..cd87349 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -223,18 +223,15 @@ load_graph_state_changed (GtkWidget *widget,
 
 static gboolean
 load_graph_draw (GtkWidget *widget,
-                 cairo_t * context,
+                 cairo_t * cr,
                  gpointer data_ptr)
 {
     LoadGraph * const graph = static_cast<LoadGraph*>(data_ptr);
-    GdkWindow *window;
 
     guint i;
     gint j;
     gdouble sample_width, x_offset;
 
-    window = gtk_widget_get_window (graph->disp);
-
     /* Number of pixels wide for one graph point */
     sample_width = (float)(graph->draw_width - graph->rmargin - graph->indent) / 
(float)LoadGraph::NUM_POINTS;
     /* General offset */
@@ -244,9 +241,6 @@ load_graph_draw (GtkWidget *widget,
     x_offset += graph->rmargin - ((sample_width / graph->frames_per_unit) * graph->render_counter);
 
     /* draw the graph */
-    cairo_t* cr;
-
-    cr = gdk_cairo_create (window);
 
     if (graph->background == NULL) {
         draw_background(graph);
@@ -289,8 +283,6 @@ load_graph_draw (GtkWidget *widget,
         }
     }
 
-    cairo_destroy (cr);
-
     return TRUE;
 }
 


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