Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
5.5.1, 5.6.1
-
None
Description
QPainter::drawImage() crashes with QTransform rotation by 270 and also -90 degrees with a memory access exception in function qt_memrotate90_tiled.
I tested this under Windows 7. With other rotation degrees and especially degrees like 90 and 180 degrees it works. As a workaround, I can rotate 270 degrees by rotate 90 and than 180 degrees in two steps.
A small code snippet to explain what I do:
....
// Set up QTransform for rotation
QTransform TransformCenter;
TransformCenter.translate(rotatedImageWidth / 2.0, rotatedImageHeight / 2.0);
TransformCenter.rotate(270.0);
TransformCenter.translate(-originalImageWidth / 2.0, -originalImageWidth / 2.0);
// Rotate the image by drawing it in the new image
QPainter Painter;
Painter.begin(rotatedImage);
Painter.fillRect(0, 0, rotatedImageWidth, rotatedImageHeight, Qt::GlobalColor::white);
Painter.setTransform(TransformCenter);
// While drawImage the crash occurs in qt_memrotate90_tiled
Painter.drawImage(QPoint(0, 0), originalImage);
Painter.end();