From bd256890034dd450d3112f50b2145775f2a8db80 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 11 May 2019 21:07:19 +0200 Subject: [PATCH] Clean up qtriangulator_p.h Remove the bogus default constructor and copy special member function of the structs there. They just disable move semantics and the compiler will be happy to generate them for you when you let it. These classes are all pure inline, so remove the export macros. Last, not least, remove the broken assignment operator of QVertexIndexVector. The copy constructor was implicitly declared, so was doing something completely different (the correct thing, I might argue), while the hand-rolled, useless op= checked this->t to check which of the vectors to copy (instead of checking other.t, which it later copies). Change-Id: I696f01602e02c0ddb2e5348ec85fd2a622544226 Reviewed-by: Thiago Macieira --- src/gui/painting/qtriangulator_p.h | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/gui/painting/qtriangulator_p.h b/src/gui/painting/qtriangulator_p.h index c9ae2571f4..177e5e66ed 100644 --- a/src/gui/painting/qtriangulator_p.h +++ b/src/gui/painting/qtriangulator_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -class Q_GUI_EXPORT QVertexIndexVector +class QVertexIndexVector { public: enum Type { @@ -93,19 +93,6 @@ public: return indices16.size(); } - QVertexIndexVector() = default; - QVertexIndexVector(const QVertexIndexVector &other) = default; - inline QVertexIndexVector &operator = (const QVertexIndexVector &other) - { - if (t == UnsignedInt) - indices32 = other.indices32; - else - indices16 = other.indices16; - - t = other.t; - return *this; - } - private: Type t; @@ -113,23 +100,15 @@ private: QVector indices16; }; -struct Q_GUI_EXPORT QTriangleSet +struct QTriangleSet { - inline QTriangleSet() { } - inline QTriangleSet(const QTriangleSet &other) : vertices(other.vertices), indices(other.indices) { } - QTriangleSet &operator = (const QTriangleSet &other) {vertices = other.vertices; indices = other.indices; return *this;} - // The vertices of a triangle are given by: (x[i[n]], y[i[n]]), (x[j[n]], y[j[n]]), (x[k[n]], y[k[n]]), n = 0, 1, ... QVector vertices; // [x[0], y[0], x[1], y[1], x[2], ...] QVertexIndexVector indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...] }; -struct Q_GUI_EXPORT QPolylineSet +struct QPolylineSet { - inline QPolylineSet() { } - inline QPolylineSet(const QPolylineSet &other) : vertices(other.vertices), indices(other.indices) { } - QPolylineSet &operator = (const QPolylineSet &other) {vertices = other.vertices; indices = other.indices; return *this;} - QVector vertices; // [x[0], y[0], x[1], y[1], x[2], ...] QVertexIndexVector indices; // End of polyline is marked with -1. };