[Interest] Drawing slow.

william.crocker at analog.com william.crocker at analog.com
Sun Aug 19 13:10:08 CEST 2018


>>
>>   From some experimentation it appears that the CPU time required by the
>> QPainterPath system is quite non-linear in the number of control points.
>> So, if I break my one long path up into a number of shorter paths, it
>> draws MUCH faster.
>>
> Is that the case with both antialiasing on and off? (They use different
> rasterization backends)
>

Yes.
I suspected AA in the beginning, but that was not the problem.
QPainterPaths with a large element count was the problem.
And I am not doing anything too fancy.
Just a lot of lineTo/moveTo.

After every added segment:

         if( path.elementCount() > 100 ) {
               // Long paths take too long to draw.
             QPointF cur = path.currentPosition();
             painter->drawPath(path); path = QPainterPath();
             path.moveTo(cur);
         }

Bill



More information about the Interest mailing list