1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-04-16 10:29:10 +02:00

Do not unnecessary convert the image tiles to pixmaps

This commit is contained in:
Martin Tůma 2023-02-23 22:46:45 +01:00
parent a5916cad90
commit ae3d190e08

View File

@ -1,7 +1,6 @@
#include <QPainter> #include <QPainter>
#include "image.h" #include "image.h"
#define TILE_SIZE 256 #define TILE_SIZE 256
void Image::draw(QPainter *painter, const QRectF &rect, Map::Flags flags) void Image::draw(QPainter *painter, const QRectF &rect, Map::Flags flags)
@ -17,9 +16,9 @@ void Image::draw(QPainter *painter, const QRectF &rect, Map::Flags flags)
for (int j = sr.top()/TILE_SIZE; j <= sr.bottom()/TILE_SIZE; j++) { for (int j = sr.top()/TILE_SIZE; j <= sr.bottom()/TILE_SIZE; j++) {
QPoint tl(i * TILE_SIZE, j * TILE_SIZE); QPoint tl(i * TILE_SIZE, j * TILE_SIZE);
QRect tile(tl, QSize(TILE_SIZE, TILE_SIZE)); QRect tile(tl, QSize(TILE_SIZE, TILE_SIZE));
QPixmap pm(QPixmap::fromImage(_img.copy(tile))); QImage img(_img.copy(tile));
pm.setDevicePixelRatio(ratio); img.setDevicePixelRatio(ratio);
painter->drawPixmap(tl/ratio, pm); painter->drawImage(tl/ratio, img);
} }
} }
} else } else