return this_;
}
+void graphics_image_free(struct graphics *gra, struct graphics_image *img)
+{
+ if (gra->meth.image_free)
+ gra->meth.image_free(gra->priv, img->priv);
+ g_free(img);
+}
+
void
graphics_draw_restore(struct graphics *this_, struct point *p, int w, int h)
{
p.x=di->pnt[0].x - img->hot.x;
p.y=di->pnt[0].y - img->hot.y;
gra->meth.draw_image(gra->priv, gra->gc[0]->priv, &p, img->priv);
+ graphics_image_free(gra, img);
+ img = NULL;
}
break;
case element_image:
#endif
profile(0,NULL);
do_draw(displaylist, trans, mapsets, order);
- profile(1,"do_draw");
+// profile(1,"do_draw");
graphics_displaylist_draw(gra, displaylist, trans, l);
profile(1,"xdisplay_draw");
profile(0,"end");
void (*register_resize_callback)(struct graphics_priv *gr, void (*callback)(void *data, int w, int h), void *data);
void (*register_button_callback)(struct graphics_priv *gr, void (*callback)(void *data, int pressed, int button, struct point *p), void *data);
void (*register_motion_callback)(struct graphics_priv *gr, void (*callback)(void *data, struct point *p), void *data);
+ void (*image_free)(struct graphics_priv *gr, struct graphics_image_priv *priv);
};
void graphics_gc_set_background(struct graphics_gc *gc, struct color *c);
void graphics_gc_set_linewidth(struct graphics_gc *gc, int width);
struct graphics_image *graphics_image_new(struct graphics *gra, char *path);
+void graphics_image_free(struct graphics *gra, struct graphics_image *img);
void graphics_draw_restore(struct graphics *this_, struct point *p, int w, int h);
void graphics_draw_mode(struct graphics *this_, enum draw_mode_num mode);
void graphics_draw_lines(struct graphics *this_, struct graphics_gc *gc, struct point *p, int count);
return ret;
}
+static void
+image_free(struct graphics_priv *gr, struct graphics_image_priv *priv)
+{
+ if (priv->pixbuf)
+ gdk_pixbuf_unref(priv->pixbuf);
+ g_free(priv);
+}
+
static void
draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
{
register_resize_callback,
register_button_callback,
register_motion_callback,
+ image_free,
};
static struct graphics_priv *
register_resize_callback,
register_button_callback,
register_motion_callback,
+ NULL, // image_free
};
static struct graphics_priv *