diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-01-17 22:03:27 +0100 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2021-01-20 08:47:18 +0100 |
commit | b07a7fe5f10529f7fde0b7d5f614aa311b18dcc7 (patch) | |
tree | f7d8b5d62bcadeb20ea09728915cf851863ad5db /stats/chartitem.h | |
parent | 409f159e1d8875f72f50d371860d4aef1975f065 (diff) | |
download | subsurface-b07a7fe5f10529f7fde0b7d5f614aa311b18dcc7.tar.gz |
statistics: convert scatter series to use QSG
The original plan to reuse the ChartPixmapItem for the
scatteritems was dumped, because it is unclear if the
textures are shared if generated for each item.
Instead, a new ChartScatterItem was created, where all
items share the same textures (one for highlighted,
one for non-highlighted). This means that the rendering
of the scatter items is now done in the chartitem.cpp
file, which feels like a layering violation. Not good,
but the easiest for now.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats/chartitem.h')
-rw-r--r-- | stats/chartitem.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/stats/chartitem.h b/stats/chartitem.h index 650c45d53..338c23b8b 100644 --- a/stats/chartitem.h +++ b/stats/chartitem.h @@ -150,6 +150,26 @@ private: std::unique_ptr<QSGGeometry> whiskersGeometry; }; +// An item in a scatter chart. This is not simply a normal pixmap item, +// because we want that all items share the *same* texture for memory +// efficiency. It is somewhat questionable to define the form of the +// scatter item here, but so it is for now. +class ChartScatterItem : public HideableChartProxyItem<QSGImageNode> { +public: + ChartScatterItem(StatsView &v, ChartZValue z); + ~ChartScatterItem(); + + void setPos(QPointF pos); // Specifies the *center* of the item. + void setHighlight(bool highlight); // In the future, support different kinds of scatter items. + void render() override; // Only call on render thread! + QRectF getRect() const; + bool contains(QPointF point) const; +private: + QRectF rect; + QSizeF textureSize; + bool positionDirty, textureDirty; + bool highlighted; +}; // Implementation detail of templates - move to serparate header file template <typename Node> |