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

QPainter::drawLine() results differ from Debug to Release

    XMLWordPrintable

Details

    Description

      This code on Windows:

      #include <QCoreApplication>
      #include <QImage>
      #include <QPainter>
      
      int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);
      
          QImage img(200, 200, QImage::Format_ARGB32_Premultiplied);
          img.fill(Qt::transparent);
          QPainter p(&img);
          p.setPen(QPen(Qt::yellow, 3));
          p.drawLine(50, 50, 100, 50);
          p.end();
          img.save("example.png");
      
          return 0;
      }
      

      When built and run as Debug program produces an image with a 3 pixel wide line (expected). When built and run as Release program produces an image with a 2 pixel wide line (unexpected). See attached images.

      On Linux the problem does not manifest.

      This seems to appear only when the width is an odd integer.

      Attachments

        Issue Links

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

          Activity

            People

              sletta Gunnar Sletta
              chrisw67 Chris Williams
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes