On 19-03-2019 01:54, Michelle Long wrote:
I've added a function to addOnDraw for a DrawingArea and it paints using the code I have when I resize.

I added a queueDraw in threadsAddIdle and it seems to draws the screen immediately but it does not seem to be called again.

If I put queueDraw inside the addOnDraw routine then the animation works but it is quite slow, about 1 fps and cpu usage is 100% without it, it is 0%.

You will probably want to use glib.Timeout to make the time between redraws consistent. The callBack for treadsAddIdle or glib.Idle is only called when the mainloop has nothing else to do.

The cairo clock demo is a good example: https://github.com/gtkd-developers/GtkD/blob/master/demos/cairo/cairo_clock/clock.d

If performance is an issue one option would be to save your context in a cairo surface and only redraw the parts that have changed.

--
Mike Wey

Reply via email to