From b07a7fe5f10529f7fde0b7d5f614aa311b18dcc7 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 17 Jan 2021 22:03:27 +0100 Subject: 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 --- stats/chartitem.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'stats/chartitem.h') 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 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 { +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 -- cgit v1.2.3-70-g09d2