summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-11-12 11:00:15 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-11-12 11:00:15 (GMT)
commit3490be25a1be8465e4aa0fea8f0cef3b3850ed52 (patch)
tree31931e011f8ac4eb9ca0d54d67054d8cc9926f52
parent0621ff5286d3e511fb9d630b9576eb04c0783c95 (diff)
Reduce variable scope
-rw-r--r--src/lib/marble/declarative/Routing.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/marble/declarative/Routing.cpp b/src/lib/marble/declarative/Routing.cpp
index 5da902b..ff4a67e 100644
--- a/src/lib/marble/declarative/Routing.cpp
+++ b/src/lib/marble/declarative/Routing.cpp
@@ -46,7 +46,6 @@ public:
QObject * m_parent;
QVector<Placemark *> m_searchResultPlacemarks;
QMap<int, QQuickItem*> m_searchResultItems;
- QVector<QPolygonF*> m_cachedPolygons;
};
RoutingPrivate::RoutingPrivate(QObject *parent) :
@@ -97,15 +96,16 @@ QSGNode * Routing::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) {
routingManager->routeColorStandard() :
routingManager->routeColorStandard().darker( 200 );
- geoPainter.polygonsFromLineString( waypoints, d->m_cachedPolygons);
+ QVector<QPolygonF*> polygons;
+ geoPainter.polygonsFromLineString( waypoints, polygons);
- if (!d->m_cachedPolygons.isEmpty()) {
+ if (!polygons.isEmpty()) {
delete oldNode;
oldNode = new QSGNode;
QSGFlatColorMaterial *material = new QSGFlatColorMaterial;
material->setColor(standardRouteColor);
- foreach(const QPolygonF* itPolygon, d->m_cachedPolygons) {
+ foreach(const QPolygonF* itPolygon, polygons) {
int segmentCount = itPolygon->size() - 1;
@@ -114,6 +114,7 @@ QSGNode * Routing::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) {
QSGGeometry * lineNodeGeo = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 2*segmentCount);
lineNodeGeo->setLineWidth(width);
lineNodeGeo->setDrawingMode(GL_LINE_STRIP);
+ lineNodeGeo->setLineWidth(width);
lineNodeGeo->allocate(2*segmentCount);
lineNode->setGeometry(lineNodeGeo);
@@ -129,9 +130,7 @@ QSGNode * Routing::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) {
}
}
- qDeleteAll(d->m_cachedPolygons);
- d->m_cachedPolygons.clear();
-
+ qDeleteAll(polygons);
return oldNode;
}