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

raster engine does not create deep copies when painting on QPixmap with QPainter

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.2
    • 4.7.1
    • GUI: Painting
    • None
    • Harmattan Scratchbox
    • 9a63863d6f0c614c041c3d4b375bf88d93148ef7, eac9e6a11e7727d8a749242f317362337ce89a1d

    Description

      In the code below a pixmap is created. We then create a copy of the pixmap and save it as QImage. The pixmap is then modified and a second copy is created.
      With the native graphicssystem both images are different as expected - with the raster graphicssystem both images have the same content. No deep copy is created.
      If e.g. p->fill() is called a second time after the first copy has been made the deep copy is created as expected.

      QPixmap *p = new QPixmap(300, 300);
      p->fill(QColor(255, 255, 255, 0));
      QPainter *myPainter = new QPainter(p);

      QImage img1 = p->toImage();
      img1.save("/tmp/img1.png");

      myPainter->setBrush(Qt::black);
      myPainter->drawEllipse(10, 10, 100, 100);

      QImage img2 = p->toImage();
      img2.save("/tmp/img2.png");

      if (img1 == img2)

      { qWarning("FAIL!"); }

      Attachments

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

        Activity

          People

            rodal Samuel Rødal
            aberres Armin Berres
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes