From 657d93ca99a4dd910db2b6a5411fd1b0db055239 Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Mon, 4 Nov 2019 07:26:30 +0930 Subject: [PATCH] Fix texture rotation --- src/texturegenerator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/texturegenerator.cpp b/src/texturegenerator.cpp index 6a2606be..babf5f7e 100644 --- a/src/texturegenerator.cpp +++ b/src/texturegenerator.cpp @@ -337,9 +337,9 @@ void TextureGenerator::generate() rect.height() * TextureGenerator::m_textureSize }; if (translatedRect.width() < translatedRect.height()) { - painter.drawTiledPixmap(translatedRect, rotatedPixmap); + painter.drawTiledPixmap(translatedRect, rotatedPixmap, QPointF(rect.top(), rect.left())); } else { - painter.drawTiledPixmap(translatedRect, pixmap); + painter.drawTiledPixmap(translatedRect, pixmap, rect.topLeft()); } } painter.setOpacity(1.0); @@ -358,7 +358,7 @@ void TextureGenerator::generate() QMatrix matrix; matrix.translate(center.x(), center.y()); matrix.rotate(90); - auto rotatedImage = scaledImage.transformed(matrix); + auto rotatedImage = scaledImage.transformed(matrix).mirrored(true, false); targetMap[it.first] = std::make_pair(QPixmap::fromImage(scaledImage), QPixmap::fromImage(rotatedImage)); }