]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Do not use static variable in gfx_prep_text() 875/head
authorMatwey V. Kornilov <matwey.kornilov@gmail.com>
Sat, 10 Feb 2018 21:44:06 +0000 (00:44 +0300)
committerMatwey V. Kornilov <matwey.kornilov@gmail.com>
Sat, 10 Feb 2018 21:45:20 +0000 (00:45 +0300)
Move last_tabwidth to image_desc_t

Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
src/rrd_gfx.c
src/rrd_graph.c
src/rrd_graph.h

index fa7b22337403c8076103031575779486e6373a6e..a8446eb3981a39e8c4e05e252659d8ed7bec7a72 100644 (file)
@@ -165,8 +165,6 @@ static PangoLayout *gfx_prep_text(
     const PangoFontDescription *pfd;
     cairo_t  *cr = im->cr;
 
-    static double last_tabwidth = -1;
-
 
 
     /* for performance reasons we might
@@ -179,10 +177,10 @@ static PangoLayout *gfx_prep_text(
     
     gchar    *utf8_text;
 
-    if (last_tabwidth < 0 || last_tabwidth != tabwidth){
+    if (im->last_tabwidth < 0 || im->last_tabwidth != tabwidth){
         PangoTabArray *tab_array;
         // fprintf(stderr,"t");
-        last_tabwidth = tabwidth;
+        im->last_tabwidth = tabwidth;
         tab_array = pango_tab_array_new(tab_count, (gboolean) (1));
         for (i = 1; i <= tab_count; i++) {
              pango_tab_array_set_tab(tab_array,
index 0b8179e921fe5b7a754849a0bb33a1a244a8d8be..8d07c6042da64e2ad99e11b69769bdc7da6734dd 100644 (file)
@@ -4799,6 +4799,7 @@ void rrd_graph_init(
     im->ysize = 100;
     im->zoom = 1;
     im->init_mode = init_mode;
+    im->last_tabwidth = -1;
 
     if (init_mode == IMAGE_INIT_CAIRO) {
         im->font_options = cairo_font_options_create();
index ad57ffdd0b47b7ff7ab820b95164b20f15d339ae..51e627cc3028b6d70178bbf824fd683281f868ee 100644 (file)
@@ -354,6 +354,7 @@ typedef struct image_desc_t {
     enum image_init_en init_mode; /* do we need Cairo/Pango? */
     double x_pixie; /* scale for X (see xtr() for reference) */
     double y_pixie; /* scale for Y (see ytr() for reference) */
+    double last_tabwidth; /* (see gfx_prep_text() for reference) */
 } image_desc_t;
 
 /* Prototypes */