summaryrefslogtreecommitdiffstats
path: root/profile-widget/diveprofileitem.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2017-10-18 06:33:37 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-10-18 06:34:15 -0400
commit432110ac8faa3775feab35d53a9cdbeecfa7fe27 (patch)
tree2fa1fb03e92a5e73eb9c49dd4abe9da2a998d3ba /profile-widget/diveprofileitem.cpp
parenta525fff1125265f9c68fd202b7ec1931dc529729 (diff)
downloadsubsurface-432110ac8faa3775feab35d53a9cdbeecfa7fe27.tar.gz
Find current gasmix for heatmap
To compute the heatmap value, we need the current gasmix but the current cylinderindex is no longer available. Fixes #562 Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'profile-widget/diveprofileitem.cpp')
-rw-r--r--profile-widget/diveprofileitem.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp
index 02a0745e7..1cd8fae4f 100644
--- a/profile-widget/diveprofileitem.cpp
+++ b/profile-widget/diveprofileitem.cpp
@@ -11,6 +11,7 @@
#endif
#include "qt-models/diveplannermodel.h"
#include "core/helpers.h"
+#include "core/dive.h"
#include "core/subsurface-qt/SettingsObjectWrapper.h"
#include "libdivecomputer/parser.h"
#include "profile-widget/profilewidget2.h"
@@ -424,8 +425,11 @@ void DivePercentageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
for (int i = 1, modelDataCount = dataModel->rowCount(); i < modelDataCount; i++) {
if (i < poly.count()) {
double value = dataModel->index(i, vDataColumn).data().toDouble();
- int cyl = dataModel->index(i, DivePlotDataModel::CYLINDERINDEX).data().toInt();
- int inert = 1000 - get_o2(&displayed_dive.cylinder[cyl].gasmix);
+ struct gasmix *gasmix = NULL;
+ struct event *ev = NULL;
+ int sec = dataModel->index(i, DivePlotDataModel::TIME).data().toInt();
+ gasmix = get_gasmix(&displayed_dive, current_dc, sec, &ev, gasmix);
+ int inert = 1000 - get_o2(gasmix);
mypen.setBrush(QBrush(ColorScale(value, inert)));
painter->setPen(mypen);
painter->drawLine(poly[i - 1], poly[i]);