[gdk;gdkpixbuf] Optimisation. Is it possible?



I'd like to create a lot of images from some values.
Values is in some type of tree (background, what in right upper 
corner, what in ...).
Is it possible to reuse GdkGC for enother GdkDrawable then in 
constructor?

Something like:

G_INLINE GdkGC *return_gc_background1(GdkDrawable *gd) {
  static GdkGC *gc = NULL;
  static GdkColor color;
  if(G_UNLIKLY(!gc)) { //It's used many times but once init.
    gc = gdk_gc_new(gd);
    gdk_color_parse("ff0000", &color); //1
    gdk_gc_set_foreground(gc, &color);
  }
  return gc; //What will be happend if enother GdkDrawable
}

I cannot check it now..

Best regards.






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