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

QPaint::drawText \ QTextLayout::endLayout take half a second on first call in Windows.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.3, 5.15.0
    • GUI: Font handling
    • None
    • Tested in both MinGW 7.3 and MSVC 2019.
    • Windows

    Description

      When trying to draw text to an image, the first rendered line takes more than half a second to get drawn (on a core i7 6700).

      This happens both when using QPainter's drawText function, or when drawing glyphruns using QTextLayout (what actually takes time is the first call to QTextLayout's endLayout, painting the glyphs does not take much time, and subsequent calls to endLayout are also quick.).

       

      On Linux, the same code runs very quickly.

       

      Here's code to reproduce the problem:

       

       

      
      int main(int argc, char *argv[])
      {
       QString text("Hello World");
       QGuiApplication a(argc, argv);
       QFont font("Arial", 100);
      
       QImage img(1000, 1000, QImage::Format_RGB888);
      
       QPainter painter(&img);
      
       painter.setBrush(QColor(255, 255, 255);
      
       painter.drawRect(QRect(0, 0, 1000, 1000));
      
       painter.setPen(QColor(0, 0, 0));
      
       painter.setFont(font);
      
       painter.drawText(QRect(0, 0, 1000, 1000), text);
       return 0;
      }
       
      

       

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            feature.engineer Feature Engineer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes