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

Qt4.3.1/Mac: Suggestion to improve performance of drawing to a QBitmap on Mac

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • P2: Important
    • Some future release
    • 4.3.1
    • GUI: Painting
    • None
    • macOS

    Description

      Drawing lines into a QBitmap is significantly slower on Mac than on Linux.

      When comparing Linux and Mac it seems to be a factor of 6 slower on Mac than on Linux.
      This seems to be only related to drawing to a QBitmap, drawing to a QImage instead has much more similar performance on the different platforms.

      It would be nice if it was possible to increase the performance of drawing to a QBitmap on Mac.

      Reproducible with the following code,

      #include <qapplication.h>
      #include <qbitmap.h>
      #include <qpainter.h>
      #include <qpen.h>
      #include <qdatetime.h>
      #include <stdio.h>

      QTime Time;
      #define TIME(s) if (s) fprintf(stderr, "%4d %s\n", Time.restart(), s); else Time.start();

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);
      QBitmap bitmap(1200, 1000);
      TIME(NULL);
      bitmap.clear();
      QPainter painter(&bitmap);
      painter.setPen(QPen(Qt::color1));
      for (int i = 0; i < 250000; i++)

      { painter.drawLine(1, 1, 500, 1); }

      TIME("draw");
      return 0;
      }

      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
              admin Administrator
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes