From 2b961414d7a52d442f5ecd8c2e42e43d044d0d5e Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 12 Jan 2021 15:20:05 +0100 Subject: statistics: draw legend as a QSGNode In order not to waste CPU by constantly rerendering the chart, we must use these weird OpenGL QSGNode things. The interface is appallingly low-level and unfriendly. As a first test, try to convert the legend. Create a wrapper class that represents a rectangular item with a texture and that will certainly need some (lots of) optimization. Make sure that all low-level QSG-objects are only accessed in the rendering thread. This means that the wrapper has to maintain a notion of "dirtiness" of the state. I.e. which part of the QSG-objects have to be modified. From the low-level wrapper derive a class that draws a rounded rectangle for every resize. The child class of that must then paint on the rectangle after every resize. That looks all not very fortunate, but it displays a legend and will make it possible to move the legend without and drawing operations, only shifting around an OpenGL surface. The render thread goes through all chart-items and rerenders them if dirty. Currently, on deletion of these items, this list is not reset. I.e. currently it is not supported to remove individual items. Only the full scene can be cleared! Signed-off-by: Berthold Stoeger --- stats/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'stats/CMakeLists.txt') diff --git a/stats/CMakeLists.txt b/stats/CMakeLists.txt index a084dd0b5..c0fbe3c51 100644 --- a/stats/CMakeLists.txt +++ b/stats/CMakeLists.txt @@ -9,6 +9,8 @@ set(SUBSURFACE_STATS_SRCS barseries.cpp boxseries.h boxseries.cpp + chartitem.h + chartitem.cpp chartlistmodel.h chartlistmodel.cpp informationbox.h -- cgit v1.2.3-70-g09d2