From b002670ba868b6e6a35687fe74c9137cfe0ac6f5 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 18 Feb 2014 17:48:41 +1000 Subject: Remove unnecessary code. I don't see much point in using custom Point classes. QPointF is already fully inline and constexpr. Change-Id: Ie7a854831e78d8e3ce4777a558d203765b53c9f0 Reviewed-by: Alex Blasche --- src/imports/location/qdeclarativecirclemapitem.cpp | 2 +- src/imports/location/qdeclarativepolygonmapitem.cpp | 2 +- src/imports/location/qdeclarativepolylinemapitem.cpp | 2 +- src/imports/location/qgeomapitemgeometry.cpp | 11 +++++------ src/imports/location/qgeomapitemgeometry_p.h | 15 +++------------ 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/imports/location/qdeclarativecirclemapitem.cpp b/src/imports/location/qdeclarativecirclemapitem.cpp index a76039ed..a91b26bd 100644 --- a/src/imports/location/qdeclarativecirclemapitem.cpp +++ b/src/imports/location/qdeclarativecirclemapitem.cpp @@ -214,7 +214,7 @@ void QGeoMapCircleGeometry::updateScreenPointsInvert(const QGeoMap &map) p2t::Triangle *t = tris.at(i); for (int j = 0; j < 3; ++j) { p2t::Point *p = t->GetPoint(j); - screenVertices_ << Point(p->x, p->y); + screenVertices_ << QPointF(p->x, p->y); } } delete cdt; diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp index 48346abf..032d619d 100644 --- a/src/imports/location/qdeclarativepolygonmapitem.cpp +++ b/src/imports/location/qdeclarativepolygonmapitem.cpp @@ -297,7 +297,7 @@ void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map) p2t::Triangle *t = tris.at(i); for (int j = 0; j < 3; ++j) { p2t::Point *p = t->GetPoint(j); - screenVertices_ << Point(p->x, p->y); + screenVertices_ << QPointF(p->x, p->y); } } delete cdt; diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp index 7cec7a58..aefbc435 100644 --- a/src/imports/location/qdeclarativepolylinemapitem.cpp +++ b/src/imports/location/qdeclarativepolylinemapitem.cpp @@ -432,7 +432,7 @@ void QGeoMapPolylineGeometry::updateScreenPoints(const QGeoMap &map, QPolygonF tri; const float *vs = ts.vertices(); for (int i = 0; i < (ts.vertexCount()/2*2); i += 2) { - screenVertices_ << Point(vs[i], vs[i + 1]); + screenVertices_ << QPointF(vs[i], vs[i + 1]); if (!qIsFinite(vs[i]) || !qIsFinite(vs[i + 1])) break; diff --git a/src/imports/location/qgeomapitemgeometry.cpp b/src/imports/location/qgeomapitemgeometry.cpp index a8ba3eb6..587e9ab9 100644 --- a/src/imports/location/qgeomapitemgeometry.cpp +++ b/src/imports/location/qgeomapitemgeometry.cpp @@ -57,10 +57,9 @@ QGeoMapItemGeometry::QGeoMapItemGeometry() */ void QGeoMapItemGeometry::translate(const QPointF &offset) { - for (int i = 0; i < screenVertices_.size(); ++i) { - screenVertices_[i].x += offset.x(); - screenVertices_[i].y += offset.y(); - } + for (int i = 0; i < screenVertices_.size(); ++i) + screenVertices_[i] += offset; + firstPointOffset_ += offset; screenOutline_.translate(offset); screenBounds_.translate(offset); @@ -71,7 +70,7 @@ void QGeoMapItemGeometry::translate(const QPointF &offset) */ void QGeoMapItemGeometry::allocateAndFill(QSGGeometry *geom) const { - const QVector &vx = screenVertices_; + const QVector &vx = screenVertices_; const QVector &ix = screenIndices_; if (isIndexed()) { @@ -91,7 +90,7 @@ void QGeoMapItemGeometry::allocateAndFill(QSGGeometry *geom) const QSGGeometry::Point2D *pts = geom->vertexDataAsPoint2D(); for (int i = 0; i < vx.size(); ++i) - pts[i].set(vx[i].x, vx[i].y); + pts[i].set(vx[i].x(), vx[i].y()); } /*! diff --git a/src/imports/location/qgeomapitemgeometry_p.h b/src/imports/location/qgeomapitemgeometry_p.h index 3e4a6247..39ad5bd5 100644 --- a/src/imports/location/qgeomapitemgeometry_p.h +++ b/src/imports/location/qgeomapitemgeometry_p.h @@ -58,15 +58,6 @@ class QGeoMap; class QGeoMapItemGeometry { public: - - struct Point - { - inline Point(qreal x, qreal y) : x(x), y(y) {} - inline Point() : x(0), y(0) {} - inline Point(const QPointF &pt) : x(pt.x()), y(pt.y()) {} - qreal x, y; - }; - QGeoMapItemGeometry(); inline bool isSourceDirty() const { return sourceDirty_; } @@ -97,10 +88,10 @@ public: } inline QVector2D vertex(quint32 index) const { - return QVector2D(screenVertices_[index].x, screenVertices_[index].y); + return QVector2D(screenVertices_[index]); } - inline QVector vertices() const { return screenVertices_; } + inline QVector vertices() const { return screenVertices_; } inline QVector indices() const { return screenIndices_; } inline bool isIndexed() const { return (!screenIndices_.isEmpty()); } @@ -142,7 +133,7 @@ protected: QGeoCoordinate srcOrigin_; - QVector screenVertices_; + QVector screenVertices_; QVector screenIndices_; }; -- cgit v1.2.1