Re: Goocanvas : performance problem with goocanvas group ?



On Tue, 2010-04-06 at 15:21 +0200, Alex Vasic wrote:
> Hi Goocanvas users and developers,
> 
> I'm currently working on a program that uses goocanvas widget on GTK+.
> I need to create an item group with several goocanvas items like
> rectangles and a text. The group can be moved in a canvas with the
> mouse, exactly like in goocanvas demo found in goocanvas package. So i
> decided to take back the example for my necessity.
> However, if i have succeeded to draw correctly the goocanvas group and
> moving the group with mouse runs, my test program is always catching
> the cpu load at about 20 % (and moving item group is very slow) even
> if i don't do anything on the canvas. I'm not able to find the origin
> of the problem. If i replace the goocanvas group by a simple item
> (just a rectangle) like in the demo, there's no cpu overload.
> Furthermore, there's a strange "phantom" on the canvas of my item
> group text that it's deleted when i move my item group over it.

It looks like you are creating new canvas items in the paint() method,
which will probably cause problems. Try creating them in new() or
somewhere else.

paint() is called each time the item is redrawn so it looks like you are
creating new items each time the main item moves.

Damon





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]