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 <thiago.macieira@intel.com>
Marc Mutz 2019-05-11 21:07:19 +02:00
parent ac83032c60
commit bd25689003
1 changed files with 3 additions and 24 deletions

View File

@ -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<quint16> 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<qreal> 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<qreal> vertices; // [x[0], y[0], x[1], y[1], x[2], ...]
QVertexIndexVector indices; // End of polyline is marked with -1.
};