I need another pair of GTK3 skilled eyes to help me find the drawing performance issue in my glinegraph-cairo project. It's a GtkWidget I extracted from 'GApcMon' back in 2007 and I wanted to upgrade it from Gtk2 to Gtk3. The upgrade process was painless and I think I've covered all the bases.
The issue I'm having is in the GtkWidget#draw, GtkWidget#configure-event callback routines. The line chart test program adds 5 data points every 5 seconds, and the chart should start plotting a line for each data point from left to right. The time it takes to draw those lines is where the performance issue surfaces. Should be no more than 300ms when 50+ data points are being drawn. Depending on the version of Gtk3 that number could be 15 seconds, or just immediately fail with a GdkWindow out-of-memory error.
I've tried two different strategies to render the draw function.
- The classic inline method of redrawing everything inside the 'draw' callback.
- Drawing to a side surface, and letting 'draw' paint the affected region.
I've tried using the GDK Cairo Surfaces, and a Image Cairo Surface. The GDK based surface produces the worst results, with the image surface being the most stable.
I suspect there is some coding step that I've missed involving cairo surfaces, maybe I need to mark them as dirty once their drawn on. Or maybe these is something wrong with my Object Widget Structure. Right now I'm very frustrated with GTK3.
Source for this question is here:
glinegraph-cairo
Any insight or help is greatly appreciated.
I just don't see where the problem could be. I've researched several OS X related GTK issues and I'm sure OS X/Quartz's surface implementation is a part of the problem. However, OS X is just my development environment; Linux is my primary delivery platform and target. These issues are present on CentOS7, Ubuntu, and Raspbian across Gtk+-3.10 thru Gtk+3.18; so OS X issues can be ignored.
There are older GTK+2.0 versions of this widget using cairo methods and one using gdk drawing methods, located on source forge under either 'gapcmon' or 'glinegraph-cairo' and 'glinegraph-gtk', if that's helpful.