Qt World Summit 2023: Berlin awaits! Join us now
最新版Qt 6.3已正式发布。 了解更多。
最新バージョンQt6.5がご利用いただけます。 詳細はこちら

Unleashing the power of QPainterPath::addEllipse()

Up until recently, WebKit used to draw SVG circles and ellipses by breaking them down into 100-segment paths. This was done to get consistent auto-test results across different platforms and rendering libraries. Unfortunately, it wasn't very fast. With Qt 4.7's WebKit, my machine reaches a meager 17 FPS on the SVG version of The Man in Blue's benchmark which is pretty sad.

I spent some time digging into this issue and have finally landed a change upstream that makes WebKit take proper advantage of the underlying libraries - in our case by using QPainterPath::addEllipse() to compose the shapes instead of QPainterPath::lineTo(). This bumps our FPS on the aforementioned test to 51, three times faster!

New Ellipse vs. Old Ellipse. Dots mark the relevant path points.

For the specifically curious, here's the webkit.org commit: r69517

Blog Topics: