Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.12.3, 5.15.0
-
None
-
Tested in both MinGW 7.3 and MSVC 2019.
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; }