mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn event-list of divecomputer into std::vector<>
This is a rather long commit, because it refactors lots of the event code from pointer to value semantics: pointers to entries in an std::vector<> are not stable, so better use indexes. To step through the event-list at diven time stamps, add *_loop classes, which encapsulate state that had to be manually handled before by the caller. I'm not happy about the interface, but it tries to mirror the one we had before. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
8ddc960fa0
commit
27dbdd35c6
36 changed files with 644 additions and 821 deletions
|
@ -2,6 +2,7 @@
|
|||
#include "divepercentageitem.h"
|
||||
#include "divecartesianaxis.h"
|
||||
#include "core/dive.h"
|
||||
#include "core/event.h"
|
||||
#include "core/profile.h"
|
||||
|
||||
#include <array>
|
||||
|
@ -105,7 +106,7 @@ void DivePercentageItem::replot(const dive *d, const struct divecomputer *dc, co
|
|||
int x = 0;
|
||||
QRgb *scanline = (QRgb *)img.scanLine(line);
|
||||
QRgb color = 0;
|
||||
const struct event *ev = NULL;
|
||||
gasmix_loop loop(*d, *dc);
|
||||
for (int i = 0; i < pi.nr; i++) {
|
||||
const plot_data &item = pi.entry[i];
|
||||
int sec = item.sec;
|
||||
|
@ -114,7 +115,7 @@ void DivePercentageItem::replot(const dive *d, const struct divecomputer *dc, co
|
|||
continue;
|
||||
|
||||
double value = item.percentages[tissue];
|
||||
struct gasmix gasmix = get_gasmix(d, dc, sec, &ev, gasmix_air);
|
||||
struct gasmix gasmix = loop.next(sec);
|
||||
int inert = get_n2(gasmix) + get_he(gasmix);
|
||||
color = colorScale(value, inert);
|
||||
if (nextX >= width)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue