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

SIGSEG while QPainter::drawPixmap with negative scaling

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 4.6.0, 4.7.1
    • GUI: Painting
    • None

    Description

      Am sorry to not have a sample application, but it is a bit hard to reproduce.

      Am painting QPixmap (1280 x 720 - this is important), but painting it flipped:

          p->scale(1, -1);
          p->translate(0, -pixmap.height());
          p->drawPixmap(QPoint(),pixmap);
      

      The pixmap is just default fill()-ed, and is part of an QGraphicsItem of the same size.
      Now, the important part is the item itself has a parent, this parent is proportionally scaled so the image to fit in view. (This is the pixmap and its item are aways painted 1:1 and the parent handles scale).

      When I resize the main window horizontally, on some magical values (around 0.256...0.275 for the parent scale) the app crashes with:

      qblendfunctions_p.cpp:

          while (h--) {
              const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl);
              int srcx = basex;
              int x = 0;
              for (; x<w; ++x) {
                  blender.write(&dst[x], src[srcx >> 16]); //<*** Here a SIGSEGV
                  srcx += ix;
              }
              blender.flush(&dst[x]);
              dst = (quint32 *)(((uchar *) dst) + dbpl);
              srcy += iy;
          }
      

      I also must note, this happens also if I manually setTransform() on the item, without using a parent (on 4.6), but was unable to reproduce while drawing on QWidget paintEvent and directly setting the painter.scale() values.

      Attachments

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

        Activity

          People

            rodal Samuel Rødal
            mnaydenov Mihail Naydenov
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes