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

QPainter: graphical artifacts when drawing QPixmap with alpha and transformations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.7.1
    • GUI: Painting
    • None
    • Qt 4.7.1 (binary distribution) on Mac OS 10.6.5, iMac
      Qt 4.7.0 (stock Linux distro) on Kubuntu 10.10, an old Pentium III laptop ;)
      Qt 4.7.1 (binary distribution) on Windows XP SP3 (WORKS!)

      software renderer (OpenGL works!)
    • macOS

    Description

      A grey line is drawn (graphical artifact) at the very "top" (where the image should be fully translucent, i.e. alpha = 0) when drawing a QPixmap with an alpha channel gradient (from 0 to 255), and applying a QTransform rotation, see screenshot.

      How to reproduce (example):

      git clone git://github.com/ariya/screenie.git
      cd screenie
      qmake
      make

      After running the 'screenie' application you need to resize the windows, so you see the entire "reflection", including the graphical artifact.

      (Developped by Ariya Hidayat, https://code.google.com/p/screenie/

      I get the same artifact on Mac OS X 10.6.5 (binary package Qt 4.7.1) and Kubuntu 10.10 (distro Qt 4.7.0). However it WORKS on Windows XP with Qt 4.7.1 (also binary package, MinGW based). Notice that the same code used to crash on Windows with Qt 4.7.0, as soon as one dragged an image onto the "screenie" window: BLEND_SOURCE_OVER_ARGB32_SSE2 (somewhere in that macro) caused the crash. The same code however did never crash, neither on Mac OS X (also with Qt 4.7.0) and Linux Kubuntu 10.10 (still Qt 4.7.0).

      This could give a hint at where to look maybe? But then again, when using "screenie" on Windows with Qt 4.7.0 I never noticed these grey lines: the initial 3 "question mark" images were rendered correctly, without crash (the crash only happened after drag and drop).

      Another remarkable thing: the same code renders correctly on all platforms when using OpenGL:

      In the screenie code above, screenie.cpp:

      1. #include <QtOpenGL>

      2. class Screenie: public QGLWidget (make it inherit from QGLWidget instead of QWidget, around line 82)

      3. QGLFormat format(QGL::SampleBuffers);
      QGLFormat::setDefaultFormat(format);

      in main(), right after QApplication app(...)

      Unfortunatelly I could not try the code with Qt 4.6.x, but I guess this worked at some point (regression in Qt 4.7)?

      Attachments

        1. alpha_blending_artifact_transform.png
          alpha_blending_artifact_transform.png
          11 kB
        2. gradient bug.png
          gradient bug.png
          39 kB
        3. screenie_with_qglwidget.png
          screenie_with_qglwidget.png
          12 kB
        4. screenie_with_qwidget.png
          screenie_with_qwidget.png
          12 kB
        5. Test.png
          Test.png
          0.9 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            rodal Samuel Rødal
            till213 Oliver Knoll
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes