profile: cache pixmaps for dive event items

For better scalability, we might replace the dive event icons
by SVGs. Since rendering SVGs is potentially very slow, cache
the pixmaps when the scene is generated.

Note: this does not yet do any SVG rendering, only the caching
of pixmaps.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-08-30 21:11:11 +02:00 committed by Dirk Hohndel
parent 9e20cb5a49
commit f82ae2be7f
9 changed files with 163 additions and 57 deletions

View file

@ -5,7 +5,8 @@
#include "divepixmapitem.h"
class DiveCartesianAxis;
class DivePlotDataModel;
class DivePixmapCache;
class DivePixmaps;
struct event;
class DiveEventItem : public DivePixmapItem {
@ -13,7 +14,7 @@ class DiveEventItem : public DivePixmapItem {
public:
DiveEventItem(const struct dive *d, struct event *ev, struct gasmix lastgasmix,
DivePlotDataModel *model, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis,
int speed, double dpr, QGraphicsItem *parent = nullptr);
int speed, const DivePixmaps &pixmaps, QGraphicsItem *parent = nullptr);
~DiveEventItem();
const struct event *getEvent() const;
struct event *getEventMutable();
@ -28,7 +29,7 @@ slots:
private:
void setupToolTipString(struct gasmix lastgasmix);
void setupPixmap(struct gasmix lastgasmix, double dpr);
void setupPixmap(struct gasmix lastgasmix, const DivePixmaps &pixmaps);
int depthAtTime(int time);
DiveCartesianAxis *vAxis;
DiveCartesianAxis *hAxis;