From 97dbfb163b08e6e21650e249e5ecf46bbbc7c5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 31 Jan 2021 10:30:06 +0100 Subject: [PATCH] Scale the painter, not the images for performance reasons --- src/map/IMG/rastertile.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/map/IMG/rastertile.cpp b/src/map/IMG/rastertile.cpp index 6a5dc1d9..8a984882 100644 --- a/src/map/IMG/rastertile.cpp +++ b/src/map/IMG/rastertile.cpp @@ -227,9 +227,13 @@ void RasterTile::drawPolygons(QPainter *painter) SubFile::Handle hdl(poly.raster.lbl()); QImage img(poly.raster.lbl()->readImage(hdl, poly.raster.id())); + qreal sx = (qreal)size.width() / (qreal)img.width(); + qreal sy = (qreal)size.height() / (qreal)img.height(); - painter->drawImage(tl, img.scaled(size, Qt::IgnoreAspectRatio, - Qt::SmoothTransformation)); + painter->save(); + painter->scale(sx, sy); + painter->drawImage(QPointF(tl.x() / sx, tl.y() / sy), img); + painter->restore(); //painter->setPen(Qt::blue); //painter->setBrush(Qt::NoBrush);