Re: Efficient use of GDK Graphic contexts



Hi Greg,

two ideas:
1) clean: subclass the widget and store the GC in your class
2) dirty: use g_object_set/get_qdata() to attacht the GC to the objects

Stefan


I'm building a form designer application and need to draw a "grab"
border around widgets when the user selects them.  This part seems
straight forward and I've already got the border drawing working from
the expose event.  My question is how do do this in an efficient manner
since GCs seem to be tied to windows.

Currently I'm just building and destroying a new GC each time the
expose() event fires.  I know this isn't efficient at all, and I only
did it this was to test that I could actually draw a border.  GCs are
tied to windows, so it would seem I'll need a GC for each widget on my
form or can I have one GC and use it for all the widgets?  I guess I'm
asking what sort of overhead is involved in:

1) Creating a GC
2) Destroying a GC
3) Switching the window a GC is connected to
4) Memory overhead of each GC

Thanks for any help or suggestions.

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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