summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Rahn <[email protected]>2015-09-09 22:05:06 +0200
committerDennis Nienhüser <[email protected]>2015-09-09 23:31:19 +0200
commit4a0ebe50b16f3ccb5daa672e10f169a5c47b72c6 (patch)
tree63ec71f3251fa013b6df0742d443912aafb029fc
parent225853f09ed6beff1bb32745869dd1f724eafa77 (diff)
Do not apply set operations out of the viewport (render area)
Improves performance and works around a potential Qt bug in QPolgonF::subtracted()
-rw-r--r--src/lib/marble/GeoPainter.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/marble/GeoPainter.cpp b/src/lib/marble/GeoPainter.cpp
index f901b86..21ae785 100644
--- a/src/lib/marble/GeoPainter.cpp
+++ b/src/lib/marble/GeoPainter.cpp
@@ -770,7 +770,8 @@ void GeoPainter::drawPolygon ( const GeoDataPolygon & polygon,
}
- QVector<GeoDataLinearRing> innerBoundaries = polygon.innerBoundaries();
+ QRectF const viewportRect(QPointF(0.0,0.0), d->m_viewport->size());
+ QVector<GeoDataLinearRing> innerBoundaries = polygon.innerBoundaries();
foreach( const GeoDataLinearRing& itInnerBoundary, innerBoundaries ) {
QVector<QPolygonF*> innerPolygons;
d->m_viewport->screenCoordinates( itInnerBoundary, innerPolygons );
@@ -783,7 +784,9 @@ void GeoPainter::drawPolygon ( const GeoDataPolygon & polygon,
foreach( QPolygonF* itOuterPolygon, outerPolygons ) {
foreach( QPolygonF* itInnerPolygon, innerPolygons ) {
- *itOuterPolygon = itOuterPolygon->subtracted( *itInnerPolygon );
+ if (viewportRect.intersects(itInnerPolygon->boundingRect())) {
+ *itOuterPolygon = itOuterPolygon->subtracted( *itInnerPolygon );
+ }
}
}
qDeleteAll( innerPolygons );