Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Clipping in a widget's paintEvent slows down the program

$
0
0
ClipRegion is only used to make sure you don’t paint outside of a boundrary you set. It will not help you speed up your app. I think you are misunderstanding what setClipRegion does. The same amount of objects are being rendered and the same amount of pixels will be processed. The only difference is that by setting the clipRegion, now every single pixel you try to draw will be compared against the clipRegion before it’s rendered to screen. In other words you just made your application slower. To speed up your app, you could instead be more intelligent about what to draw. I.e instead of setting the clipRegion, you can check if your rectangle intersects with the view rect before you paint it and skip it if it does or sort your rectangles in some way that makes this easier. The QGraphicsView already has such functionality built in for instance.

Viewing all articles
Browse latest Browse all 4972

Trending Articles