Commit a7bbae34 authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

Cache known layers outside loop in a data structure with faster lookups

parent 237fc5ca
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment