Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-56252

QPainter::drawImage() crashes with QTransform rotation by 270 degrees

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.6.3
    • 5.5.1, 5.6.1
    • GUI: Painting
    • 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();

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            blgis Bernd Lachner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes