Move 'plot_info' into 'struct graphics_context'

.. and then allocate just the plot-info entry array dynamically.

We want to have a longer lifetime for the basic plot_info data
structure, because we want to do computer selection and maximum
time/depth/temperature computations *before* we start plotting anything,
and before we allocate the plot entry array.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2012-12-06 10:01:16 -08:00 committed by Dirk Hohndel
parent 22aa6fa4ef
commit 0d1f396f3a
2 changed files with 56 additions and 59 deletions

View file

@ -10,6 +10,19 @@
extern void repaint_dive(void);
extern void do_print(void);
/* Plot info with smoothing, velocity indication
* and one-, two- and three-minute minimums and maximums */
struct plot_info {
int nr;
int maxtime;
int meandepth, maxdepth;
int endpressure, maxpressure;
int mintemp, maxtemp, endtemp;
double endtempcoord;
gboolean has_ndl;
struct plot_data *entry;
};
/*
* Cairo scaling really is horribly horribly mis-designed.
*
@ -26,7 +39,7 @@ struct graphics_context {
double leftx, rightx;
double topy, bottomy;
unsigned int maxtime;
void *plot_info;
struct plot_info pi;
};
typedef enum { SC_SCREEN, SC_PRINT } scale_mode_t;