Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, August 2007
QPainterPath vs QPixmap speed


Message 1 in thread

Hi...

I have another question for qt-experts regarding qpainterpath: 

if I need to show & move a complex path (eg. with more than 5000 items)
along my scene, it's a good idea to draw the painterpath into a pixmap
and then to draw, in the paint event, the pixmap instead of the
painterpath ?

If the painterpath is always the same and does not change or resize,
does this speedup the render process or not ?

If yes, how can render a qpainterpath into a pixmap ? :-)

 thanks a lot 

          Andy

--
 [ signature omitted ] 

Message 2 in thread

> if I need to show & move a complex path (eg. with more than 5000
items)
> along my scene, it's a good idea to draw the painterpath into a pixmap
> and then to draw, in the paint event, the pixmap instead of the
> painterpath ?
> 
> If the painterpath is always the same and does not change or resize,
> does this speedup the render process or not ?
> 
> If yes, how can render a qpainterpath into a pixmap ? :-)

QPainterPath should be able to efficiently handle lots of items (i bet a
lot more than 5000).

Don't try to optimize something that doesn't need optimization ;) You'd
probably make things worse rather than better. (Not to mention the
problems you get into if you want to zoom etc.)

Cheers,
Peter

--
 [ signature omitted ] 

Message 3 in thread

Andy Hirsh schrieb:
> Hi...
> ...
> If the painterpath is always the same and does not change or resize,
> does this speedup the render process or not ?

I would expect that drawing a pixmap is always faster than drawing a 
(non-trivial) painter path of the same size (width, height) as the pixmap.

> If yes, how can render a qpainterpath into a pixmap ? :-)

The QPixmap inherits from QPaintDevice. That means you can "paint" into 
it with a QPainter as you would into a QWidget or QPrinter.

Cheers, Oliver

--
 [ signature omitted ]