From: Matwey V. Kornilov Date: Sat, 10 Feb 2018 21:44:06 +0000 (+0300) Subject: Do not use static variable in gfx_prep_text() X-Git-Tag: v1.7.1~63^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F875%2Fhead;p=thirdparty%2Frrdtool-1.x.git Do not use static variable in gfx_prep_text() Move last_tabwidth to image_desc_t Signed-off-by: Matwey V. Kornilov --- diff --git a/src/rrd_gfx.c b/src/rrd_gfx.c index fa7b2233..a8446eb3 100644 --- a/src/rrd_gfx.c +++ b/src/rrd_gfx.c @@ -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, diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 0b8179e9..8d07c604 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -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(); diff --git a/src/rrd_graph.h b/src/rrd_graph.h index ad57ffdd..51e627cc 100644 --- a/src/rrd_graph.h +++ b/src/rrd_graph.h @@ -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 */