From 7a53fb8e01541d6f22a5883a4dd33d482d71eb37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 22 Feb 2023 23:22:18 +0100 Subject: [PATCH] Remove the qpainter/qimage draw workaround Seems to be fixed in newer Qt versions and it did not properly work in older Qt versions anyway... --- src/map/image.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/map/image.cpp b/src/map/image.cpp index 4a7cc161..eba69559 100644 --- a/src/map/image.cpp +++ b/src/map/image.cpp @@ -11,26 +11,17 @@ void Image::draw(QPainter *painter, const QRectF &rect, Map::Flags flags) /* When OpenGL is used, big images are rendered incredibly slow or not at all using the QPainter::drawImage() function with a source rect set. So - we have to tile the image ourself before it can be drawn. - - We have to use a list of dynamically allocated pixmaps as QPainter - rendering is broken in yet another way with OpenGL and drawPixmap() does - access already deleted image instances when reusing a single pixmap. */ + we have to tile the image ourself before it can be drawn. */ if (flags & Map::OpenGL) { - QList list; - for (int i = sr.left()/TILE_SIZE; i <= sr.right()/TILE_SIZE; i++) { for (int j = sr.top()/TILE_SIZE; j <= sr.bottom()/TILE_SIZE; j++) { QPoint tl(i * TILE_SIZE, j * TILE_SIZE); QRect tile(tl, QSize(TILE_SIZE, TILE_SIZE)); - QPixmap *pm = new QPixmap(QPixmap::fromImage(_img.copy(tile))); - list.append(pm); - pm->setDevicePixelRatio(ratio); - painter->drawPixmap(tl/ratio, *pm); + QPixmap pm(QPixmap::fromImage(_img.copy(tile))); + pm.setDevicePixelRatio(ratio); + painter->drawPixmap(tl/ratio, pm); } } - - qDeleteAll(list); } else painter->drawImage(rect.topLeft(), _img, sr); }