pike.git / src / post_modules / GTK2 / source / support.c

version» Context lines:

pike.git/src/post_modules/GTK2/source/support.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: support.c,v 1.23 2010/02/09 17:53:42 ldillon Exp $ + || $Id: support.c,v 1.24 2010/07/31 23:35:36 marcus Exp $   */      #include <version.h>   #include <bignum.h>   #include <stdarg.h>      #ifndef INIT_VARIABLES   extern struct program *image_color_program;   extern struct program *image_program;   #endif
pike.git/src/post_modules/GTK2/source/support.c:79:    struct color_struct *col;    col=(struct color_struct *)get_storage(o,image_color_program);    if (!col)    return 0;    *r=col->rgbl.r/(COLORLMAX/65535);    *g=col->rgbl.g/(COLORLMAX/65535);    *b=col->rgbl.b/(COLORLMAX/65535);    return 1;   }    - GdkImage *gdkimage_from_pikeimage(struct object *img, int fast, GdkImage *i) { + GdkImage *gdkimage_from_pikeimage(struct object *img, int fast, GObject **pi) { +  GdkImage *i;    GdkColormap *col=gdk_colormap_get_system();    GdkVisual *vis=gdk_visual_get_system();    struct image *img_data;    INT_TYPE x,y;       TIMER_INIT("Getting extents");       img_data=(struct image*)get_storage(img, image_program);       /* 1a: create the actual image... */    x = img_data->xsize;    y = img_data->ysize;          if (x==0 || y==0)    Pike_error("Size of image must be > 0x0\n"); -  if (i) { -  if ((i->width!=x) || (i->height!=y)) { -  gdk_image_destroy((void *)i); +  if (pi) { +  i = *pi; +  if (i != NULL && ((i->width!=x) || (i->height!=y))) { +  g_object_unref(i); +  gdk_image_destroy(i);    i=NULL;    } -  } +  } else +  i=NULL;    if (!i) {    PFTIME("Create");    i=(void *)gdk_image_new(fast,vis,x,y);    } -  +  if (pi) +  *pi = i;       if (!i)    Pike_error("Failed to create gdkimage\n");       /* 1b: do the work.. */       if (vis->type==GDK_VISUAL_TRUE_COLOR || vis->type==GDK_VISUAL_STATIC_GRAY)    /* no colormap.. */    {    int pad=0;