PDA

View Full Version : Performance problem with GrapicsPathItem



amnesiks
19th March 2007, 17:10
Hello,

I don't speak english very well, but I'll try to write something clear.

I'm making an image segmentation program, and I'm getting performance problem.

The program's aim is to show an image and its segmentation, and to allow the user to zoom on it, and to move it.

To make it work, I used a GraphicsView, and a GraphicsScene. First, I put a QPixmap on the GraphicsScene. It worked very well (zooming and moving was fast). Then I put a GraphicsPathItem on it, which represents the segmentation (its like a big path, which draws kind of shapes in the picture). The path can contain from 400 to 30 000 points, and I observed that the program's speed is really dependent on the number of points. (with a 30 000 points's path, it's VERY slow even with a 1.5GHz pc)

Is that normal ?

I don't understand why the program can draw a QPixmap or a QImage with 1 000 000 points very fast, and can not draw a 30 000 points's path with the same speed...

To build the QGraphicsPathItem, I build a QPainterPath with the moveto() and lineto() methods using a QPoint (not QPointF), then I use addPath method the add it in the GraphicsScene.

Thanks for help !!

macbeth
20th March 2007, 02:48
Look here (http://www.qtcentre.org/forum/f-qt-programming-2/t-rendering-rectangles-speed-issue-6038.html), I'm facing a similar problem... You must probably use some optimization, lessen the number of points, etc...

themolecule
23rd July 2007, 05:24
I also am having this problem... it seems to only happen on QGraphicsPathItem objects, not other types of QGraphics*Items...

it's as if some thread is left running in the background after the object is created...

---

it doesn't seem to be a thread...

it's the paint routine getting called over and over again. something is causing it to be marked dirty or something.