summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2013-12-04 00:12:01 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-03 15:22:49 -0800
commit04bbfe2ab18223c8a6d39683212c6eaefbdf66f2 (patch)
tree83a3f001637ccf245ab76948f684e34f5f5e0fad
parent25bfcf5f6d0ed9a16705dcd2ae095daf6c852dd1 (diff)
downloadsubsurface-04bbfe2ab18223c8a6d39683212c6eaefbdf66f2.tar.gz
Disable calc_ndl_tts for print
NDL and TTS doesn't show up in the printed profiles, and it takes significant time to calculate, so just don't do it. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--profile.c11
-rw-r--r--profile.h2
-rw-r--r--qt-ui/profilegraphics.cpp2
3 files changed, 8 insertions, 7 deletions
diff --git a/profile.c b/profile.c
index 3493b996d..6e3019729 100644
--- a/profile.c
+++ b/profile.c
@@ -1013,7 +1013,7 @@ static void calculate_ndl_tts(double tissue_tolerance, struct plot_data *entry,
/* Let's try to do some deco calculations.
* Needs to be run before calculate_gas_information so we know that if we have a po2, where in ccr-mode.
*/
-static void calculate_deco_information(struct dive *dive, struct divecomputer *dc, struct plot_info *pi)
+static void calculate_deco_information(struct dive *dive, struct divecomputer *dc, struct plot_info *pi, bool print_mode)
{
int i;
double surface_pressure = (dc->surface_pressure.mbar ? dc->surface_pressure.mbar : get_surface_pressure_in_mbar(dive, TRUE)) / 1000.0;
@@ -1034,8 +1034,9 @@ static void calculate_deco_information(struct dive *dive, struct divecomputer *d
for (j=0; j<16; j++)
entry->ceilings[j] = deco_allowed_depth(tolerated_by_tissue[j], surface_pressure, dive, 1);
- /* should we do more calculations? */
- if (prefs.calc_ndl_tts) {
+ /* should we do more calculations?
+ * We don't for print-mode because this info doesn't show up there */
+ if (prefs.calc_ndl_tts && !print_mode) {
/* We are going to mess up deco state, so store it for later restore */
char *cache_data = NULL;
cache_deco_state(tissue_tolerance, &cache_data);
@@ -1117,7 +1118,7 @@ static void calculate_gas_information(struct dive *dive, struct plot_info *pi)
* sides, so that you can do end-points without having to worry
* about it.
*/
-struct plot_info *create_plot_info(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc)
+struct plot_info *create_plot_info(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc, bool print_mode)
{
struct plot_info *pi;
@@ -1147,7 +1148,7 @@ struct plot_info *create_plot_info(struct dive *dive, struct divecomputer *dc, s
/* Then, calculate deco information */
if (prefs.profile_calc_ceiling)
- calculate_deco_information(dive, dc, pi);
+ calculate_deco_information(dive, dc, pi, print_mode);
/* And finaly calculate gas partial pressures */
calculate_gas_information(dive, pi);
diff --git a/profile.h b/profile.h
index 563fa700d..c64ecfbf6 100644
--- a/profile.h
+++ b/profile.h
@@ -44,7 +44,7 @@ struct plot_data {
};
void calculate_max_limits(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc);
-struct plot_info *create_plot_info(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc);
+struct plot_info *create_plot_info(struct dive *dive, struct divecomputer *dc, struct graphics_context *gc, bool print_mode);
int setup_temperature_limits(struct graphics_context *gc);
int get_cylinder_pressure_range(struct graphics_context *gc);
void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int bufsize, int sum);
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 0d38a89f9..93ab1e1ab 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -403,7 +403,7 @@ void ProfileGraphicsView::plot(struct dive *d, bool forceRedraw)
gc.maxy = (profile_grid_area.height() - 2 * profile_grid_area.y());
/* This is per-dive-computer */
- gc.pi = *create_plot_info(dive, dc, &gc);
+ gc.pi = *create_plot_info(dive, dc, &gc, printMode);
/* Bounding box */
QPen pen = defaultPen;