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

QPainter::drawPixmap() may not fill entire area when painter is scaled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P2: Important P2: Important
    • Some future release
    • 4.3.3
    • GUI: Painting
    • None

      Consider the following paintEvent() reimplementation:

      void TilingWidget::paintEvent(QPaintEvent *event) {
      QPainter painter(this);
      painter.scale(1.0 / 3.0, 1.0 / 3.0);

      for(int i = 0; i < 10; ++i) {
      for(int j = 0; j < 10; ++j)

      { QRect area(i * 100, j * 100, 100, 100); QPixmap pix(area.size()); pix.fill(Qt::yellow); painter.fillRect(area, Qt::blue); painter.drawPixmap(area, pix); }

      }
      }

      The expected result is that the entire painted area is yellow, since a yellow pixmap is painted on top of the blue background.

      The actual result is that when the painter is scaled down by a number with infinite decimal expansion (1.0 / 3.0, for example), drawPixmap() does not work correctly, and artifacts show up. In the above example, parts of the blue background can be seen in recurring vertical and horizontal lines.

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

            rodal Samuel Rødal
            sthomass Stian Sandvik Thomassen (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes