1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Scale the painter, not the images for performance reasons

This commit is contained in:
Martin Tůma 2021-01-31 10:30:06 +01:00
parent 33f2002a52
commit 97dbfb163b

View File

@ -227,9 +227,13 @@ void RasterTile::drawPolygons(QPainter *painter)
SubFile::Handle hdl(poly.raster.lbl()); SubFile::Handle hdl(poly.raster.lbl());
QImage img(poly.raster.lbl()->readImage(hdl, poly.raster.id())); 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, painter->save();
Qt::SmoothTransformation)); painter->scale(sx, sy);
painter->drawImage(QPointF(tl.x() / sx, tl.y() / sy), img);
painter->restore();
//painter->setPen(Qt::blue); //painter->setPen(Qt::blue);
//painter->setBrush(Qt::NoBrush); //painter->setBrush(Qt::NoBrush);