summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-10-10 07:07:20 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-10-10 12:56:41 (GMT)
commita7bbae347d94b4de5cac143f1f952fc0e52794ad (patch)
tree4bdea1d05587cce61cac3acc38229473427ac495
parent237fc5cafc29e523da2b0fcbac53b079e40500ae (diff)
Cache known layers outside loop in a data structure with faster lookups
-rw-r--r--src/lib/marble/layers/GeometryLayer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/marble/layers/GeometryLayer.cpp b/src/lib/marble/layers/GeometryLayer.cpp
index ee91f6d..d0a90d7 100644
--- a/src/lib/marble/layers/GeometryLayer.cpp
+++ b/src/lib/marble/layers/GeometryLayer.cpp
@@ -133,6 +133,7 @@ bool GeometryLayer::render( GeoPainter *painter, ViewportParams *viewport,
QList<LayerItem> defaultLayer;
int paintedItems = 0;
QHash<QString, QList<GeoGraphicsItem*> > paintedFragments;
+ QSet<QString> const knownLayers = QSet<QString>::fromList(d->m_styleBuilder->renderOrder());
auto const viewLatLonAltBox = viewport->viewLatLonAltBox();
foreach( GeoGraphicsItem* item, items ) {
if ( item->latLonAltBox().intersects(viewLatLonAltBox) ) {
@@ -142,7 +143,7 @@ bool GeometryLayer::render( GeoPainter *painter, ViewportParams *viewport,
paintLayers << QString();
}
foreach(const auto &layer, paintLayers) {
- if (d->m_styleBuilder->renderOrder().contains(layer)) {
+ if (knownLayers.contains(layer)) {
paintedFragments[layer] << item;
} else {
defaultLayer << LayerItem(layer, item);