profile: merge plotDive() into draw() call

Rendering resets the size, which now recalculates the axes.
Therefore, plotDive() must be called. The callers were doing
the opposite: call plotDive() first, then draw().

To make it easier for the callers, present a single interface
that handles these subtleties.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-08-30 22:59:45 +02:00 committed by Dirk Hohndel
parent d0beae59f9
commit 8046a05e95
7 changed files with 22 additions and 39 deletions

View file

@ -610,8 +610,7 @@ void PlannerWidgets::printDecoPlan()
painter.setRenderHint(QPainter::SmoothPixmapTransform);
auto profile = std::make_unique<ProfileScene>(1.0, true, false);
profile->plotDive(&displayed_dive, 0, DivePlannerPointsModel::instance(), true, true);
profile->draw(&painter, QRect(0, 0, pixmap.width(), pixmap.height()));
profile->draw(&painter, QRect(0, 0, pixmap.width(), pixmap.height()), &displayed_dive, 0, DivePlannerPointsModel::instance(), true);
QByteArray byteArray;
QBuffer buffer(&byteArray);