summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-08 17:46:28 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-08 14:19:10 -0700
commitef7ace9926276f401cceb45d546a7134eeea0f00 (patch)
tree7d94c75b3b4a823989e4b77a8c9254b7abb79ccf /profile.c
parentce8d30b938b80c334eb0869650c3c463084ae018 (diff)
downloadsubsurface-ef7ace9926276f401cceb45d546a7134eeea0f00.tar.gz
Plot the temperature Graph
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c79
1 files changed, 26 insertions, 53 deletions
diff --git a/profile.c b/profile.c
index 2a8d5e4ed..f68822009 100644
--- a/profile.c
+++ b/profile.c
@@ -201,6 +201,32 @@ void remember_event(const char *eventname)
evn_used++;
}
+int setup_temperature_limits(struct graphics_context *gc, struct plot_info *pi)
+{
+ int maxtime, mintemp, maxtemp, delta;
+
+ /* Get plot scaling limits */
+ maxtime = get_maxtime(pi);
+ mintemp = pi->mintemp;
+ maxtemp = pi->maxtemp;
+
+ gc->leftx = 0; gc->rightx = maxtime;
+ /* Show temperatures in roughly the lower third, but make sure the scale
+ is at least somewhat reasonable */
+ delta = maxtemp - mintemp;
+ if (delta < 3000) /* less than 3K in fluctuation */
+ delta = 3000;
+ gc->topy = maxtemp + delta*2;
+
+ if (PP_GRAPHS_ENABLED)
+ gc->bottomy = mintemp - delta * 2;
+ else
+ gc->bottomy = mintemp - delta / 3;
+
+ pi->endtempcoord = SCALEY(gc, pi->mintemp);
+ return maxtemp && maxtemp >= mintemp;
+}
+
#if 0
static void render_depth_sample(struct graphics_context *gc, struct plot_data *entry, const text_render_options_t *tro)
{
@@ -441,31 +467,7 @@ static void plot_pp_gas_profile(struct graphics_context *gc, struct plot_info *p
}
-static int setup_temperature_limits(struct graphics_context *gc, struct plot_info *pi)
-{
- int maxtime, mintemp, maxtemp, delta;
- /* Get plot scaling limits */
- maxtime = get_maxtime(pi);
- mintemp = pi->mintemp;
- maxtemp = pi->maxtemp;
-
- gc->leftx = 0; gc->rightx = maxtime;
- /* Show temperatures in roughly the lower third, but make sure the scale
- is at least somewhat reasonable */
- delta = maxtemp - mintemp;
- if (delta < 3000) /* less than 3K in fluctuation */
- delta = 3000;
- gc->topy = maxtemp + delta*2;
-
- if (PP_GRAPHS_ENABLED)
- gc->bottomy = mintemp - delta * 2;
- else
- gc->bottomy = mintemp - delta / 3;
-
- pi->endtempcoord = SCALEY(gc, pi->mintemp);
- return maxtemp && maxtemp >= mintemp;
-}
static void plot_single_temp_text(struct graphics_context *gc, int sec, int mkelvin)
{
@@ -515,35 +517,6 @@ static void plot_temperature_text(struct graphics_context *gc, struct plot_info
plot_single_temp_text(gc, sec, last_temperature);
}
-static void plot_temperature_profile(struct graphics_context *gc, struct plot_info *pi)
-{
- int i;
- cairo_t *cr = gc->cr;
- int last = 0;
-
- if (!setup_temperature_limits(gc, pi))
- return;
-
- cairo_set_line_width_scaled(gc->cr, 2);
- set_source_rgba(gc, TEMP_PLOT);
- for (i = 0; i < pi->nr; i++) {
- struct plot_data *entry = pi->entry + i;
- int mkelvin = entry->temperature;
- int sec = entry->sec;
- if (!mkelvin) {
- if (!last)
- continue;
- mkelvin = last;
- }
- if (last)
- line_to(gc, sec, mkelvin);
- else
- move_to(gc, sec, mkelvin);
- last = mkelvin;
- }
- cairo_stroke(cr);
-}
-
/* gets both the actual start and end pressure as well as the scaling factors */
static int get_cylinder_pressure_range(struct graphics_context *gc, struct plot_info *pi)
{