mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
f82ae2be7f
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>
39 lines
999 B
C++
39 lines
999 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVEPIXMAPCACHE_H
|
|
#define DIVEPIXMAPCACHE_H
|
|
|
|
#include <QPixmap>
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
// Since (some) pixmaps are rendered from SVG, which may be very slow,
|
|
// cache them once per ProfileScene. Different ProfileScenes may have
|
|
// different pixmap sizes. Scenes are created rarely (once per print
|
|
// job or UI window), so it should be fine to render the pixmaps
|
|
// on construction.
|
|
struct DivePixmaps {
|
|
int dpr;
|
|
QPixmap warning;
|
|
QPixmap info;
|
|
QPixmap violation;
|
|
QPixmap bailout;
|
|
QPixmap onCCRLoop;
|
|
QPixmap bookmark;
|
|
QPixmap gaschangeTrimixICD;
|
|
QPixmap gaschangeTrimix;
|
|
QPixmap gaschangeAirICD;
|
|
QPixmap gaschangeAir;
|
|
QPixmap gaschangeOxygenICD;
|
|
QPixmap gaschangeOxygen;
|
|
QPixmap gaschangeEANICD;
|
|
QPixmap gaschangeEAN;
|
|
QPixmap transparent;
|
|
~DivePixmaps();
|
|
DivePixmaps(int dpr);
|
|
};
|
|
|
|
// Note: This is NOT thread safe. Must be called from UI thread!
|
|
extern std::shared_ptr<const DivePixmaps> getDivePixmaps(double dpr);
|
|
|
|
#endif
|