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

QPainter->drawPixmap appears to be carrying some state between calls

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.4.1
    • Active Qt
    • None
    • Edition Windows 10 Home
      Version 21H2
      OS build 19044.2364
    • Windows

    Description

      [Updated repro] Simple repro attached as QPixmapBug.zip in qmake project format

      drawing multiple QPixmaps in an OpenGLWidget is failing after drawing the first QPixmap.

      It appears there is some kind of state that is being carried between calls to drawPixmap(), If I use QPainter->begin() [which destroys / recreates default state] and QPainter->end() between calls to drawPixmap() all of the QPixmaps draw correctly.  However, if I try to use QPainter->save() and QPainter->restore() to save and restore state between calls to drawPixmap, only the 1st QPixmap is drawn correctly.

      I have not seen this same behavior in another program that I wrote using an OpenGlWidget, doing the same method of drawing multiple QPixmaps (without need for extra 'begin' or 'save').

      I can only imagine it has something to do with the way the QPixmap is generated, which in this case is coming from QSvgRenderer->QPainter->QImage->QPixmap and then is used.

      I tried debugging in to QPainter.cpp and QPaintEngine_raster.cpp and analyzing the state between creation and drawPixmap but I couldn't find anything that was obvious or useful.

       

      Any help would be appreciated, and if there is something more I can do to try and track down the issue let me know.

       

      [More Info]

      I can reproduce without needing to use an SVG image.  I simply create a QImage then convert to a QPixmap.  I'm not sure what I'm doing wrong to cause this issue, as I cannot see it in other code I have running doing similar.

      Anything to help would be awesome, thank you!

       

      Thanks!

       

      Attachments

        Activity

          People

            owolff Oliver Wolff
            darrenaa D A
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: