From 85fd574b385bbad781238c66b9a00aa3f52e49c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 22 Nov 2024 20:45:43 +0100 Subject: [PATCH] Do not try to draw labels outside the tile rect --- src/map/mapsforge/rastertile.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/map/mapsforge/rastertile.cpp b/src/map/mapsforge/rastertile.cpp index 5ba33d90..79a7ac12 100644 --- a/src/map/mapsforge/rastertile.cpp +++ b/src/map/mapsforge/rastertile.cpp @@ -231,8 +231,13 @@ void RasterTile::processLineLabels(const QVector &paths, void RasterTile::drawTextItems(QPainter *painter, const QList &textItems) { - for (int i = 0; i < textItems.size(); i++) - textItems.at(i)->paint(painter); + QRectF rect(_rect); + + for (int i = 0; i < textItems.size(); i++) { + const TextItem *ti = textItems.at(i); + if (rect.intersects(ti->boundingRect())) + ti->paint(painter); + } } QPainterPath RasterTile::painterPath(const Polygon &polygon, bool curve) const