profile: move axis animation code to ProfileView

This feels quite a bit slower than the non-QtQuick version. This
makes sense, as there is an additional level of indirection. Instead
of painting directly, we paint into an QImage and turn that into
a QSGTexture.

Ultimately one would think that we should render directly using
QtQuick. Alas, we can't, since that would mean no more printing/
exporting of profiles. How sad.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2023-05-20 15:22:02 +02:00
parent 15ea0440ad
commit 196a33ba4b
4 changed files with 58 additions and 49 deletions

View file

@ -27,7 +27,6 @@ class DiveReportedCeiling;
class DiveTemperatureItem;
class DiveTextItem;
class PartialPressureGasItem;
class ProfileAnimation;
class TankItem;
class ProfileScene : public QGraphicsScene {
@ -42,8 +41,8 @@ public:
// Can be compared with literal 1.0 to determine "end" state.
// If a plannerModel is passed, the deco-information is taken from there.
void plotDive(const struct dive *d, int dc, DivePlannerPointsModel *plannerModel = nullptr, bool inPlanner = false,
bool instant = false, bool keepPlotInfo = false, bool calcMax = true, double zoom = 1.0, double zoomedPosition = 0.0);
void plotDive(const struct dive *d, int dc, int animSpeed, DivePlannerPointsModel *plannerModel = nullptr, bool inPlanner = false,
bool keepPlotInfo = false, bool calcMax = true, double zoom = 1.0, double zoomedPosition = 0.0);
void draw(QPainter *painter, const QRect &pos,
const struct dive *d, int dc,
@ -61,7 +60,6 @@ private:
void updateVisibility(bool diveHasHeartBeat, bool simplified); // Update visibility of non-interactive chart features according to preferences
void updateAxes(bool diveHasHeartBeat, bool simplified); // Update axes according to preferences
friend class ProfileWidget2; // For now, give the ProfileWidget full access to the objects on the scene
double dpr; // Device Pixel Ratio. A DPR of one corresponds to a "standard" PC screen.
bool printMode;
bool isGrayscale;
@ -101,7 +99,6 @@ private:
DivePercentageItem *percentageItem;
TankItem *tankItem;
std::shared_ptr<const DivePixmaps> pixmaps;
std::unique_ptr<ProfileAnimation> animation;
std::vector<DiveCartesianAxis *> animatedAxes;
};