[Gtk-sharp-list] Custom Widget Animation Degrades Over Time

Michael Hutchinson m.j.hutchinson at gmail.com
Thu Jul 29 15:26:16 EDT 2010


On Thu, Jul 29, 2010 at 1:40 PM, Aaron Radich <aaron at radich.com> wrote:
> I've created a custom marquee widget that displays scrolling text and
> images similar.  The widget works great when first ran, but over time
> slows down eventually grinding down to a halt/freeze.  I'm assuming that
> there is some sort of resource issue that I am not managing wisely.  Most
> of the magic for the display happens in the DrawingArea's ExposeEvent,
> which I am forcing to fire with the DrawingArea.QueueDraw() method call
> (looping triggered from a GLib.Timeout).  Does anyone see anything that
> might be contributing to my performance
> issue?

Nothing jumps out immediately - I suggest you try profiling with
heap-shot and the statistical profiler. You're probably leaking
resources of some kind.

FWIW you could make the code a fair bit more efficient by using
Pixbufs instead of System.Drawing.*.

If the widget has its own GdkWindow you could call Gdk.Window.Scroll
in the timeout to do a more efficient movement of the contents, then
have the expose event simply paint the remaining invalidated region.

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Gtk-sharp-list mailing list