summaryrefslogtreecommitdiffstats
path: root/stats/statshelper.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-02-06 12:26:54 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-02-06 10:05:41 -0800
commit5b6f4685475be7f7b68375fcab465c1626950296 (patch)
tree5321de5a6baff8d6e41e6919a52bae724c300518 /stats/statshelper.h
parentf1203d365a4a890410038943cdd4aaaaf6ab558c (diff)
downloadsubsurface-5b6f4685475be7f7b68375fcab465c1626950296.tar.gz
statistics: don't place labels at half-integer values
Placing labels at half-integer values gives horrible rendering artifacts. Therefore, always round to integer values. The easiest way to do this is right before setting the position. Introduce a helper function to round QPointF in such scenarios. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'stats/statshelper.h')
-rw-r--r--stats/statshelper.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/stats/statshelper.h b/stats/statshelper.h
index 6b4a30ab5..45d58d022 100644
--- a/stats/statshelper.h
+++ b/stats/statshelper.h
@@ -1,12 +1,16 @@
// SPDX-License-Identifier: GPL-2.0
-// Helper functions to render the stats. Currently contains
+// Helper functions to render the stats. Includes
// QSGNode template jugglery to overcome API flaws.
#ifndef STATSHELPER_H
#define STATSHELPER_H
#include <memory>
+#include <QPointF>
#include <QSGNode>
+// Round positions to integer values to avoid ugly artifacts
+QPointF roundPos(const QPointF &p);
+
// A stupid pointer class that initializes to null and can be copy
// assigned. This is for historical reasons: unique_ptrs to ChartItems
// were replaced by plain pointers. Instead of nulling the plain pointers