pass a GdkGC to gdk_draw_rgb_image(), fixed dither offsets.
2002-01-30 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorarea.c: pass a GdkGC to gdk_draw_rgb_image(), fixed dither offsets. * app/core/gimpobject.[ch]: new virtual function gimp_object_get_memsize(). * app/base/temp-buf.[ch] * app/base/tile-manager.[ch]: added *_get_memsize() methods. * app/core/gimp.c * app/core/gimpbrush.c * app/core/gimpbrushpipe.c * app/core/gimpbuffer.c * app/core/gimpchannel.c * app/core/gimpcontainer.c * app/core/gimpcontext.c * app/core/gimpdata.c * app/core/gimpdatafactory.c * app/core/gimpdrawable.c * app/core/gimpgradient.c * app/core/gimpimage.c * app/core/gimplayer.c * app/core/gimplist.c * app/core/gimpmoduleinfo.c * app/core/gimppalette.c * app/core/gimpparasitelist.c * app/core/gimppattern.c * app/core/gimppreviewcache.[ch] * app/core/gimpundo.[ch] * app/core/gimpundostack.c * app/core/gimpviewable.c: added get_memsize() implementations. * app/widgets/gimppreview.c * app/core/gimpobject.[ch]: some #ifdef DEBUG_MEMSIZE code to test the new memsize stuff (middle click any preview to get it's viewable's memory footprint).
This commit is contained in:
committed by
Michael Natterer
parent
f0df9ed379
commit
be87dfb5fb
39
ChangeLog
39
ChangeLog
@ -1,3 +1,42 @@
|
||||
2002-01-30 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* libgimpwidgets/gimpcolorarea.c: pass a GdkGC to
|
||||
gdk_draw_rgb_image(), fixed dither offsets.
|
||||
|
||||
* app/core/gimpobject.[ch]: new virtual function
|
||||
gimp_object_get_memsize().
|
||||
|
||||
* app/base/temp-buf.[ch]
|
||||
* app/base/tile-manager.[ch]: added *_get_memsize() methods.
|
||||
|
||||
* app/core/gimp.c
|
||||
* app/core/gimpbrush.c
|
||||
* app/core/gimpbrushpipe.c
|
||||
* app/core/gimpbuffer.c
|
||||
* app/core/gimpchannel.c
|
||||
* app/core/gimpcontainer.c
|
||||
* app/core/gimpcontext.c
|
||||
* app/core/gimpdata.c
|
||||
* app/core/gimpdatafactory.c
|
||||
* app/core/gimpdrawable.c
|
||||
* app/core/gimpgradient.c
|
||||
* app/core/gimpimage.c
|
||||
* app/core/gimplayer.c
|
||||
* app/core/gimplist.c
|
||||
* app/core/gimpmoduleinfo.c
|
||||
* app/core/gimppalette.c
|
||||
* app/core/gimpparasitelist.c
|
||||
* app/core/gimppattern.c
|
||||
* app/core/gimppreviewcache.[ch]
|
||||
* app/core/gimpundo.[ch]
|
||||
* app/core/gimpundostack.c
|
||||
* app/core/gimpviewable.c: added get_memsize() implementations.
|
||||
|
||||
* app/widgets/gimppreview.c
|
||||
* app/core/gimpobject.[ch]: some #ifdef DEBUG_MEMSIZE code to
|
||||
test the new memsize stuff (middle click any preview to get
|
||||
it's viewable's memory footprint).
|
||||
|
||||
2002-01-30 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/FractalExplorer/Events.c
|
||||
|
||||
@ -493,22 +493,48 @@ temp_buf_data (TempBuf *temp_buf)
|
||||
guchar *
|
||||
temp_buf_data_clear (TempBuf *temp_buf)
|
||||
{
|
||||
g_return_val_if_fail (temp_buf != NULL, NULL);
|
||||
|
||||
if (temp_buf->swapped)
|
||||
temp_buf_unswap (temp_buf);
|
||||
|
||||
|
||||
memset (temp_buf->data, 0,
|
||||
temp_buf->height * temp_buf->width * temp_buf->bytes);
|
||||
|
||||
return temp_buf->data;
|
||||
}
|
||||
|
||||
gsize
|
||||
temp_buf_get_memsize (TempBuf *temp_buf)
|
||||
{
|
||||
gsize memsize = 0;
|
||||
|
||||
g_return_val_if_fail (temp_buf != NULL, 0);
|
||||
|
||||
memsize += sizeof (TempBuf);
|
||||
|
||||
if (temp_buf->swapped)
|
||||
{
|
||||
memsize += strlen (temp_buf->filename) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
memsize += (temp_buf->bytes *
|
||||
temp_buf->width *
|
||||
temp_buf->height);
|
||||
}
|
||||
|
||||
return memsize;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************
|
||||
* Mask buffer functions *
|
||||
******************************************************************/
|
||||
|
||||
|
||||
MaskBuf *
|
||||
mask_buf_new (gint width,
|
||||
mask_buf_new (gint width,
|
||||
gint height)
|
||||
{
|
||||
static guchar empty = 0;
|
||||
@ -525,7 +551,7 @@ mask_buf_free (MaskBuf *mask)
|
||||
guchar *
|
||||
mask_buf_data (MaskBuf *mask_buf)
|
||||
{
|
||||
return temp_buf_data ((TempBuf *) mask_buf);
|
||||
return temp_buf_data ((TempBuf *) mask_buf);
|
||||
}
|
||||
|
||||
guchar *
|
||||
@ -562,11 +588,15 @@ mask_buf_data_clear (MaskBuf *mask_buf)
|
||||
*/
|
||||
|
||||
|
||||
/* a static counter for generating unique filenames */
|
||||
/* a static counter for generating unique filenames
|
||||
*/
|
||||
static gint swap_index = 0;
|
||||
|
||||
/* a static pointer which keeps track of the last request for a swapped buffer */
|
||||
static TempBuf * cached_in_memory = NULL;
|
||||
|
||||
/* a static pointer which keeps track of the last request for
|
||||
* a swapped buffer
|
||||
*/
|
||||
static TempBuf *cached_in_memory = NULL;
|
||||
|
||||
|
||||
static gchar *
|
||||
@ -614,8 +644,10 @@ temp_buf_swap (TempBuf *buf)
|
||||
cached_in_memory = buf;
|
||||
}
|
||||
|
||||
/* For the case where there is no temp buf ready to be moved to disk, return */
|
||||
if (!swap)
|
||||
/* For the case where there is no temp buf ready
|
||||
* to be moved to disk, return
|
||||
*/
|
||||
if (! swap)
|
||||
return;
|
||||
|
||||
/* Get a unique filename for caching the data to a UNIX file */
|
||||
|
||||
@ -37,57 +37,61 @@ struct _TempBuf
|
||||
|
||||
/* The temp buffer functions */
|
||||
|
||||
TempBuf * temp_buf_new (gint width,
|
||||
gint height,
|
||||
gint bytes,
|
||||
gint x,
|
||||
gint y,
|
||||
guchar *col);
|
||||
TempBuf * temp_buf_new_check (gint width,
|
||||
gint height,
|
||||
GimpCheckType check_type,
|
||||
GimpCheckSize check_size);
|
||||
TempBuf * temp_buf_copy (TempBuf *src,
|
||||
TempBuf *dest);
|
||||
TempBuf * temp_buf_resize (TempBuf *buf,
|
||||
gint bytes,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
TempBuf * temp_buf_scale (TempBuf *buf,
|
||||
gint width,
|
||||
gint height);
|
||||
TempBuf * temp_buf_copy_area (TempBuf *src,
|
||||
TempBuf *dest,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
gint dest_x,
|
||||
gint dest_y);
|
||||
void temp_buf_free (TempBuf *buf);
|
||||
guchar * temp_buf_data (TempBuf *buf);
|
||||
guchar * temp_buf_data_clear (TempBuf *buf);
|
||||
TempBuf * temp_buf_new (gint width,
|
||||
gint height,
|
||||
gint bytes,
|
||||
gint x,
|
||||
gint y,
|
||||
guchar *col);
|
||||
TempBuf * temp_buf_new_check (gint width,
|
||||
gint height,
|
||||
GimpCheckType check_type,
|
||||
GimpCheckSize check_size);
|
||||
TempBuf * temp_buf_copy (TempBuf *src,
|
||||
TempBuf *dest);
|
||||
TempBuf * temp_buf_resize (TempBuf *buf,
|
||||
gint bytes,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
TempBuf * temp_buf_scale (TempBuf *buf,
|
||||
gint width,
|
||||
gint height);
|
||||
TempBuf * temp_buf_copy_area (TempBuf *src,
|
||||
TempBuf *dest,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
gint dest_x,
|
||||
gint dest_y);
|
||||
void temp_buf_free (TempBuf *buf);
|
||||
guchar * temp_buf_data (TempBuf *buf);
|
||||
guchar * temp_buf_data_clear (TempBuf *buf);
|
||||
|
||||
gsize temp_buf_get_memsize (TempBuf *buf);
|
||||
|
||||
|
||||
/* The mask buffer functions */
|
||||
|
||||
MaskBuf * mask_buf_new (gint width,
|
||||
gint height);
|
||||
void mask_buf_free (MaskBuf *mask_buf);
|
||||
guchar * mask_buf_data (MaskBuf *mask_buf);
|
||||
guchar * mask_buf_data_clear (MaskBuf *mask_buf);
|
||||
MaskBuf * mask_buf_new (gint width,
|
||||
gint height);
|
||||
void mask_buf_free (MaskBuf *mask_buf);
|
||||
guchar * mask_buf_data (MaskBuf *mask_buf);
|
||||
guchar * mask_buf_data_clear (MaskBuf *mask_buf);
|
||||
|
||||
|
||||
/* The disk caching functions */
|
||||
|
||||
void temp_buf_swap (TempBuf *buf);
|
||||
void temp_buf_unswap (TempBuf *buf);
|
||||
void temp_buf_swap_free (TempBuf *buf);
|
||||
void temp_buf_swap (TempBuf *buf);
|
||||
void temp_buf_unswap (TempBuf *buf);
|
||||
void temp_buf_swap_free (TempBuf *buf);
|
||||
|
||||
|
||||
/* Called by app_procs:exit() to free up the cached undo buffer */
|
||||
|
||||
void swapping_free (void);
|
||||
void swapping_free (void);
|
||||
|
||||
|
||||
#endif /* __TEMP_BUF_H__ */
|
||||
|
||||
@ -586,6 +586,21 @@ tile_manager_set_offsets (TileManager *tm,
|
||||
tm->y = y;
|
||||
}
|
||||
|
||||
gsize
|
||||
tile_manager_get_memsize (const TileManager *tm)
|
||||
{
|
||||
gsize memsize = 0;
|
||||
|
||||
g_return_val_if_fail (tm != NULL, 0);
|
||||
|
||||
memsize += (sizeof (TileManager) +
|
||||
tm->ntile_rows *
|
||||
tm->ntile_cols *
|
||||
(sizeof (Tile) + tm->bpp * TILE_WIDTH * TILE_HEIGHT)); /* FIXME */
|
||||
|
||||
return memsize;
|
||||
}
|
||||
|
||||
void
|
||||
tile_manager_get_tile_coordinates (TileManager *tm,
|
||||
Tile *tile,
|
||||
|
||||
@ -122,6 +122,8 @@ void tile_manager_set_offsets (TileManager *tm,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
gsize tile_manager_get_memsize (const TileManager *tm);
|
||||
|
||||
void tile_manager_get_tile_coordinates (TileManager *tm,
|
||||
Tile *tile,
|
||||
gint *x,
|
||||
|
||||
@ -56,11 +56,13 @@
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static void gimp_class_init (GimpClass *klass);
|
||||
static void gimp_init (Gimp *gimp);
|
||||
static void gimp_class_init (GimpClass *klass);
|
||||
static void gimp_init (Gimp *gimp);
|
||||
|
||||
static void gimp_dispose (GObject *object);
|
||||
static void gimp_finalize (GObject *object);
|
||||
static void gimp_dispose (GObject *object);
|
||||
static void gimp_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_get_memsize (GimpObject *object);
|
||||
|
||||
|
||||
static GimpObjectClass *parent_class = NULL;
|
||||
@ -97,14 +99,18 @@ gimp_get_type (void)
|
||||
static void
|
||||
gimp_class_init (GimpClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->dispose = gimp_dispose;
|
||||
object_class->finalize = gimp_finalize;
|
||||
object_class->dispose = gimp_dispose;
|
||||
object_class->finalize = gimp_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_get_memsize;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -317,6 +323,53 @@ gimp_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_get_memsize (GimpObject *object)
|
||||
{
|
||||
Gimp *gimp;
|
||||
gsize memsize = 0;
|
||||
|
||||
gimp = GIMP (object);
|
||||
|
||||
memsize += g_list_length (gimp->user_units) * sizeof (GList); /* FIXME */
|
||||
|
||||
memsize += (gimp_object_get_memsize (GIMP_OBJECT (gimp->parasites)) +
|
||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->modules)));
|
||||
|
||||
memsize += (g_hash_table_size (gimp->image_table) *
|
||||
3 * sizeof (gpointer)); /* FIXME */
|
||||
memsize += (g_hash_table_size (gimp->drawable_table) *
|
||||
3 * sizeof (gpointer)); /* FIXME */
|
||||
|
||||
memsize += (gimp_object_get_memsize (GIMP_OBJECT (gimp->global_buffer)) +
|
||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->named_buffers)) +
|
||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->brush_factory)) +
|
||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->pattern_factory)) +
|
||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->gradient_factory)) +
|
||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->palette_factory)));
|
||||
|
||||
memsize += (g_hash_table_size (gimp->procedural_ht) *
|
||||
3 * sizeof (gpointer)); /* FIXME */
|
||||
|
||||
memsize += g_slist_length (gimp->load_procs) * sizeof (GSList); /* FIXME */
|
||||
memsize += g_slist_length (gimp->save_procs) * sizeof (GSList); /* FIXME */
|
||||
|
||||
memsize += (gimp_object_get_memsize (GIMP_OBJECT (gimp->tool_info_list)) +
|
||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->standard_tool_info)) +
|
||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->documents)));
|
||||
|
||||
memsize += g_list_length (gimp->image_base_type_names) * sizeof (GList); /* FIXME */
|
||||
memsize += g_list_length (gimp->fill_type_names) * sizeof (GList); /* FIXME */
|
||||
|
||||
memsize += g_list_length (gimp->context_list) * sizeof (GList);
|
||||
|
||||
memsize += (gimp_object_get_memsize (GIMP_OBJECT (gimp->standard_context)) +
|
||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->default_context)) +
|
||||
gimp_object_get_memsize (GIMP_OBJECT (gimp->user_context)));
|
||||
|
||||
return memsize = GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
Gimp *
|
||||
gimp_new (gboolean be_verbose,
|
||||
gboolean no_data,
|
||||
|
||||
@ -67,6 +67,8 @@ static void gimp_brush_init (GimpBrush *brush);
|
||||
|
||||
static void gimp_brush_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_brush_get_memsize (GimpObject *object);
|
||||
|
||||
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
@ -117,12 +119,14 @@ static void
|
||||
gimp_brush_class_init (GimpBrushClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
GimpDataClass *data_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
@ -137,6 +141,8 @@ gimp_brush_class_init (GimpBrushClass *klass)
|
||||
|
||||
object_class->finalize = gimp_brush_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_brush_get_memsize;
|
||||
|
||||
viewable_class->get_new_preview = gimp_brush_get_new_preview;
|
||||
|
||||
data_class->get_extension = gimp_brush_get_extension;
|
||||
@ -180,6 +186,23 @@ gimp_brush_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_brush_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpBrush *brush;
|
||||
gsize memsize = 0;
|
||||
|
||||
brush = GIMP_BRUSH (object);
|
||||
|
||||
if (brush->mask)
|
||||
memsize += temp_buf_get_memsize (brush->mask);
|
||||
|
||||
if (brush->pixmap)
|
||||
memsize += temp_buf_get_memsize (brush->pixmap);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_brush_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
|
||||
@ -67,6 +67,8 @@ static void gimp_brush_init (GimpBrush *brush);
|
||||
|
||||
static void gimp_brush_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_brush_get_memsize (GimpObject *object);
|
||||
|
||||
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
@ -117,12 +119,14 @@ static void
|
||||
gimp_brush_class_init (GimpBrushClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
GimpDataClass *data_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
@ -137,6 +141,8 @@ gimp_brush_class_init (GimpBrushClass *klass)
|
||||
|
||||
object_class->finalize = gimp_brush_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_brush_get_memsize;
|
||||
|
||||
viewable_class->get_new_preview = gimp_brush_get_new_preview;
|
||||
|
||||
data_class->get_extension = gimp_brush_get_extension;
|
||||
@ -180,6 +186,23 @@ gimp_brush_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_brush_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpBrush *brush;
|
||||
gsize memsize = 0;
|
||||
|
||||
brush = GIMP_BRUSH (object);
|
||||
|
||||
if (brush->mask)
|
||||
memsize += temp_buf_get_memsize (brush->mask);
|
||||
|
||||
if (brush->pixmap)
|
||||
memsize += temp_buf_get_memsize (brush->pixmap);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_brush_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
|
||||
@ -59,6 +59,8 @@ static void gimp_brush_pipe_init (GimpBrushPipe *pipe);
|
||||
|
||||
static void gimp_brush_pipe_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_brush_pipe_get_memsize (GimpObject *object);
|
||||
|
||||
static GimpBrush * gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords);
|
||||
@ -101,18 +103,22 @@ gimp_brush_pipe_get_type (void)
|
||||
static void
|
||||
gimp_brush_pipe_class_init (GimpBrushPipeClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpBrushClass *brush_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpBrushClass *brush_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
brush_class = GIMP_BRUSH_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
brush_class = GIMP_BRUSH_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_brush_pipe_finalize;
|
||||
object_class->finalize = gimp_brush_pipe_finalize;
|
||||
|
||||
brush_class->select_brush = gimp_brush_pipe_select_brush;
|
||||
brush_class->want_null_motion = gimp_brush_pipe_want_null_motion;
|
||||
gimp_object_class->get_memsize = gimp_brush_pipe_get_memsize;
|
||||
|
||||
brush_class->select_brush = gimp_brush_pipe_select_brush;
|
||||
brush_class->want_null_motion = gimp_brush_pipe_want_null_motion;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -177,6 +183,27 @@ gimp_brush_pipe_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_brush_pipe_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpBrushPipe *pipe;
|
||||
gsize memsize = 0;
|
||||
gint i;
|
||||
|
||||
pipe = GIMP_BRUSH_PIPE (object);
|
||||
|
||||
memsize += pipe->dimension * (sizeof (gint) /* rank */ +
|
||||
sizeof (gint) /* stride */ +
|
||||
sizeof (PipeSelectModes));
|
||||
|
||||
for (i = 0; i < pipe->nbrushes; i++)
|
||||
{
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (pipe->brushes[i]));
|
||||
}
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static GimpBrush *
|
||||
gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
|
||||
@ -59,6 +59,8 @@ static void gimp_brush_pipe_init (GimpBrushPipe *pipe);
|
||||
|
||||
static void gimp_brush_pipe_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_brush_pipe_get_memsize (GimpObject *object);
|
||||
|
||||
static GimpBrush * gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
GimpCoords *cur_coords);
|
||||
@ -101,18 +103,22 @@ gimp_brush_pipe_get_type (void)
|
||||
static void
|
||||
gimp_brush_pipe_class_init (GimpBrushPipeClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpBrushClass *brush_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpBrushClass *brush_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
brush_class = GIMP_BRUSH_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
brush_class = GIMP_BRUSH_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_brush_pipe_finalize;
|
||||
object_class->finalize = gimp_brush_pipe_finalize;
|
||||
|
||||
brush_class->select_brush = gimp_brush_pipe_select_brush;
|
||||
brush_class->want_null_motion = gimp_brush_pipe_want_null_motion;
|
||||
gimp_object_class->get_memsize = gimp_brush_pipe_get_memsize;
|
||||
|
||||
brush_class->select_brush = gimp_brush_pipe_select_brush;
|
||||
brush_class->want_null_motion = gimp_brush_pipe_want_null_motion;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -177,6 +183,27 @@ gimp_brush_pipe_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_brush_pipe_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpBrushPipe *pipe;
|
||||
gsize memsize = 0;
|
||||
gint i;
|
||||
|
||||
pipe = GIMP_BRUSH_PIPE (object);
|
||||
|
||||
memsize += pipe->dimension * (sizeof (gint) /* rank */ +
|
||||
sizeof (gint) /* stride */ +
|
||||
sizeof (PipeSelectModes));
|
||||
|
||||
for (i = 0; i < pipe->nbrushes; i++)
|
||||
{
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (pipe->brushes[i]));
|
||||
}
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static GimpBrush *
|
||||
gimp_brush_pipe_select_brush (GimpBrush *brush,
|
||||
GimpCoords *last_coords,
|
||||
|
||||
@ -38,6 +38,8 @@ static void gimp_buffer_init (GimpBuffer *buffer);
|
||||
|
||||
static void gimp_buffer_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_buffer_get_memsize (GimpObject *object);
|
||||
|
||||
static TempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
@ -78,15 +80,19 @@ static void
|
||||
gimp_buffer_class_init (GimpBufferClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_buffer_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_buffer_get_memsize;
|
||||
|
||||
viewable_class->get_new_preview = gimp_buffer_get_new_preview;
|
||||
}
|
||||
|
||||
@ -112,6 +118,20 @@ gimp_buffer_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_buffer_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpBuffer *buffer;
|
||||
gsize memsize = 0;
|
||||
|
||||
buffer = GIMP_BUFFER (object);
|
||||
|
||||
if (buffer->tiles)
|
||||
memsize += tile_manager_get_memsize (buffer->tiles);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_buffer_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
|
||||
@ -50,10 +50,12 @@
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static void gimp_channel_class_init (GimpChannelClass *klass);
|
||||
static void gimp_channel_init (GimpChannel *channel);
|
||||
static void gimp_channel_class_init (GimpChannelClass *klass);
|
||||
static void gimp_channel_init (GimpChannel *channel);
|
||||
|
||||
static void gimp_channel_finalize (GObject *object);
|
||||
static void gimp_channel_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_channel_get_memsize (GimpObject *object);
|
||||
|
||||
|
||||
static GimpDrawableClass * parent_class = NULL;
|
||||
@ -90,13 +92,17 @@ gimp_channel_get_type (void)
|
||||
static void
|
||||
gimp_channel_class_init (GimpChannelClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_channel_finalize;
|
||||
object_class->finalize = gimp_channel_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_channel_get_memsize;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -144,6 +150,20 @@ gimp_channel_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_channel_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpChannel *channel;
|
||||
gsize memsize = 0;
|
||||
|
||||
channel = GIMP_CHANNEL (object);
|
||||
|
||||
memsize += channel->num_segs_in * sizeof (BoundSeg);
|
||||
memsize += channel->num_segs_out * sizeof (BoundSeg);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_channel_validate (TileManager *tm,
|
||||
Tile *tile)
|
||||
|
||||
@ -50,10 +50,12 @@
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static void gimp_channel_class_init (GimpChannelClass *klass);
|
||||
static void gimp_channel_init (GimpChannel *channel);
|
||||
static void gimp_channel_class_init (GimpChannelClass *klass);
|
||||
static void gimp_channel_init (GimpChannel *channel);
|
||||
|
||||
static void gimp_channel_finalize (GObject *object);
|
||||
static void gimp_channel_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_channel_get_memsize (GimpObject *object);
|
||||
|
||||
|
||||
static GimpDrawableClass * parent_class = NULL;
|
||||
@ -90,13 +92,17 @@ gimp_channel_get_type (void)
|
||||
static void
|
||||
gimp_channel_class_init (GimpChannelClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_channel_finalize;
|
||||
object_class->finalize = gimp_channel_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_channel_get_memsize;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -144,6 +150,20 @@ gimp_channel_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_channel_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpChannel *channel;
|
||||
gsize memsize = 0;
|
||||
|
||||
channel = GIMP_CHANNEL (object);
|
||||
|
||||
memsize += channel->num_segs_in * sizeof (BoundSeg);
|
||||
memsize += channel->num_segs_out * sizeof (BoundSeg);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_channel_validate (TileManager *tm,
|
||||
Tile *tile)
|
||||
|
||||
@ -73,6 +73,8 @@ static void gimp_container_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gsize gimp_container_get_memsize (GimpObject *object);
|
||||
|
||||
static void gimp_container_disconnect_callback (GimpObject *object,
|
||||
gpointer data);
|
||||
|
||||
@ -134,9 +136,11 @@ gimp_container_get_type (void)
|
||||
static void
|
||||
gimp_container_class_init (GimpContainerClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
@ -189,21 +193,23 @@ gimp_container_class_init (GimpContainerClass *klass)
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
object_class->dispose = gimp_container_dispose;
|
||||
object_class->set_property = gimp_container_set_property;
|
||||
object_class->get_property = gimp_container_get_property;
|
||||
object_class->dispose = gimp_container_dispose;
|
||||
object_class->set_property = gimp_container_set_property;
|
||||
object_class->get_property = gimp_container_get_property;
|
||||
|
||||
klass->add = NULL;
|
||||
klass->remove = NULL;
|
||||
klass->reorder = NULL;
|
||||
klass->freeze = NULL;
|
||||
klass->thaw = NULL;
|
||||
gimp_object_class->get_memsize = gimp_container_get_memsize;
|
||||
|
||||
klass->have = NULL;
|
||||
klass->foreach = NULL;
|
||||
klass->get_child_by_name = NULL;
|
||||
klass->get_child_by_index = NULL;
|
||||
klass->get_child_index = NULL;
|
||||
klass->add = NULL;
|
||||
klass->remove = NULL;
|
||||
klass->reorder = NULL;
|
||||
klass->freeze = NULL;
|
||||
klass->thaw = NULL;
|
||||
|
||||
klass->have = NULL;
|
||||
klass->foreach = NULL;
|
||||
klass->get_child_by_name = NULL;
|
||||
klass->get_child_by_index = NULL;
|
||||
klass->get_child_index = NULL;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_CHILDREN_TYPE,
|
||||
@ -303,6 +309,29 @@ gimp_container_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_container_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpContainer *container;
|
||||
GList *list;
|
||||
gsize memsize = 0;
|
||||
|
||||
container = GIMP_CONTAINER (object);
|
||||
|
||||
for (list = container->handlers; list; list = g_list_next (list))
|
||||
{
|
||||
GimpContainerHandler *handler;
|
||||
|
||||
handler = (GimpContainerHandler *) list->data;
|
||||
|
||||
memsize += (sizeof (GList) +
|
||||
sizeof (GimpContainerHandler) +
|
||||
strlen (handler->signame));
|
||||
}
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_container_disconnect_callback (GimpObject *object,
|
||||
gpointer data)
|
||||
|
||||
@ -58,21 +58,23 @@ typedef void (* GimpContextCopyPropFunc) (GimpContext *src,
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_context_class_init (GimpContextClass *klass);
|
||||
static void gimp_context_init (GimpContext *context);
|
||||
static void gimp_context_class_init (GimpContextClass *klass);
|
||||
static void gimp_context_init (GimpContext *context);
|
||||
|
||||
static void gimp_context_dispose (GObject *object);
|
||||
static void gimp_context_finalize (GObject *object);
|
||||
|
||||
static void gimp_context_set_property (GObject *object,
|
||||
static void gimp_context_dispose (GObject *object);
|
||||
static void gimp_context_finalize (GObject *object);
|
||||
static void gimp_context_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_context_get_property (GObject *object,
|
||||
static void gimp_context_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gsize gimp_context_get_memsize (GimpObject *object);
|
||||
|
||||
|
||||
/* image */
|
||||
static void gimp_context_image_removed (GimpContainer *container,
|
||||
GimpImage *image,
|
||||
@ -366,9 +368,11 @@ gimp_context_get_type (void)
|
||||
static void
|
||||
gimp_context_class_init (GimpContextClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
@ -502,24 +506,26 @@ gimp_context_class_init (GimpContextClass *klass)
|
||||
G_TYPE_NONE, 1,
|
||||
GIMP_TYPE_IMAGEFILE);
|
||||
|
||||
object_class->set_property = gimp_context_set_property;
|
||||
object_class->get_property = gimp_context_get_property;
|
||||
object_class->dispose = gimp_context_dispose;
|
||||
object_class->finalize = gimp_context_finalize;
|
||||
object_class->set_property = gimp_context_set_property;
|
||||
object_class->get_property = gimp_context_get_property;
|
||||
object_class->dispose = gimp_context_dispose;
|
||||
object_class->finalize = gimp_context_finalize;
|
||||
|
||||
klass->image_changed = NULL;
|
||||
klass->display_changed = NULL;
|
||||
klass->tool_changed = NULL;
|
||||
klass->foreground_changed = NULL;
|
||||
klass->background_changed = NULL;
|
||||
klass->opacity_changed = NULL;
|
||||
klass->paint_mode_changed = NULL;
|
||||
klass->brush_changed = NULL;
|
||||
klass->pattern_changed = NULL;
|
||||
klass->gradient_changed = NULL;
|
||||
klass->palette_changed = NULL;
|
||||
klass->buffer_changed = NULL;
|
||||
klass->imagefile_changed = NULL;
|
||||
gimp_object_class->get_memsize = gimp_context_get_memsize;
|
||||
|
||||
klass->image_changed = NULL;
|
||||
klass->display_changed = NULL;
|
||||
klass->tool_changed = NULL;
|
||||
klass->foreground_changed = NULL;
|
||||
klass->background_changed = NULL;
|
||||
klass->opacity_changed = NULL;
|
||||
klass->paint_mode_changed = NULL;
|
||||
klass->brush_changed = NULL;
|
||||
klass->pattern_changed = NULL;
|
||||
klass->gradient_changed = NULL;
|
||||
klass->palette_changed = NULL;
|
||||
klass->buffer_changed = NULL;
|
||||
klass->imagefile_changed = NULL;
|
||||
|
||||
gimp_context_prop_types[GIMP_CONTEXT_PROP_IMAGE] = GIMP_TYPE_IMAGE;
|
||||
gimp_context_prop_types[GIMP_CONTEXT_PROP_TOOL] = GIMP_TYPE_TOOL_INFO;
|
||||
@ -891,6 +897,30 @@ gimp_context_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_context_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpContext *context;
|
||||
gsize memsize = 0;
|
||||
|
||||
context = GIMP_CONTEXT (object);
|
||||
|
||||
if (context->tool_name)
|
||||
memsize += strlen (context->tool_name) + 1;
|
||||
|
||||
if (context->brush_name)
|
||||
memsize += strlen (context->brush_name) + 1;
|
||||
|
||||
if (context->pattern_name)
|
||||
memsize += strlen (context->pattern_name) + 1;
|
||||
|
||||
if (context->palette_name)
|
||||
memsize += strlen (context->palette_name) + 1;
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* public functions ********************************************************/
|
||||
|
||||
|
||||
@ -49,13 +49,15 @@ enum
|
||||
};
|
||||
|
||||
|
||||
static void gimp_data_class_init (GimpDataClass *klass);
|
||||
static void gimp_data_init (GimpData *data);
|
||||
static void gimp_data_class_init (GimpDataClass *klass);
|
||||
static void gimp_data_init (GimpData *data);
|
||||
|
||||
static void gimp_data_finalize (GObject *object);
|
||||
static void gimp_data_finalize (GObject *object);
|
||||
|
||||
static void gimp_data_name_changed (GimpObject *object);
|
||||
static void gimp_data_real_dirty (GimpData *data);
|
||||
static void gimp_data_name_changed (GimpObject *object);
|
||||
static gsize gimp_data_get_memsize (GimpObject *object);
|
||||
|
||||
static void gimp_data_real_dirty (GimpData *data);
|
||||
|
||||
|
||||
static guint data_signals[LAST_SIGNAL] = { 0 };
|
||||
@ -141,6 +143,7 @@ gimp_data_class_init (GimpDataClass *klass)
|
||||
object_class->finalize = gimp_data_finalize;
|
||||
|
||||
gimp_object_class->name_changed = gimp_data_name_changed;
|
||||
gimp_object_class->get_memsize = gimp_data_get_memsize;
|
||||
|
||||
klass->dirty = gimp_data_real_dirty;
|
||||
klass->save = NULL;
|
||||
@ -180,6 +183,20 @@ gimp_data_name_changed (GimpObject *object)
|
||||
gimp_data_dirty (GIMP_DATA (object));
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_data_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpData *data;
|
||||
gsize memsize = 0;
|
||||
|
||||
data = GIMP_DATA (object);
|
||||
|
||||
if (data->filename)
|
||||
memsize += strlen (data->filename) + 1;
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_data_save (GimpData *data)
|
||||
{
|
||||
|
||||
@ -34,13 +34,15 @@
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
static void gimp_data_factory_class_init (GimpDataFactoryClass *klass);
|
||||
static void gimp_data_factory_init (GimpDataFactory *factory);
|
||||
static void gimp_data_factory_class_init (GimpDataFactoryClass *klass);
|
||||
static void gimp_data_factory_init (GimpDataFactory *factory);
|
||||
|
||||
static void gimp_data_factory_finalize (GObject *object);
|
||||
static void gimp_data_factory_finalize (GObject *object);
|
||||
|
||||
static void gimp_data_factory_data_load_callback (const gchar *filename,
|
||||
gpointer callback_data);
|
||||
static gsize gimp_data_factory_get_memsize (GimpObject *object);
|
||||
|
||||
static void gimp_data_factory_data_load_callback (const gchar *filename,
|
||||
gpointer callback_data);
|
||||
|
||||
|
||||
static GimpObjectClass *parent_class = NULL;
|
||||
@ -77,13 +79,17 @@ gimp_data_factory_get_type (void)
|
||||
static void
|
||||
gimp_data_factory_class_init (GimpDataFactoryClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_data_factory_finalize;
|
||||
object_class->finalize = gimp_data_factory_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_data_factory_get_memsize;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -113,6 +119,19 @@ gimp_data_factory_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_data_factory_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpDataFactory *factory;
|
||||
gsize memsize = 0;
|
||||
|
||||
factory = GIMP_DATA_FACTORY (object);
|
||||
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (factory->container));
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
GimpDataFactory *
|
||||
gimp_data_factory_new (GType data_type,
|
||||
const gchar **data_path,
|
||||
@ -130,7 +149,7 @@ gimp_data_factory_new (GType data_type,
|
||||
|
||||
factory = g_object_new (GIMP_TYPE_DATA_FACTORY, NULL);
|
||||
|
||||
factory->container = gimp_data_list_new (data_type);
|
||||
factory->container = gimp_data_list_new (data_type);
|
||||
|
||||
factory->data_path = data_path;
|
||||
|
||||
|
||||
@ -65,13 +65,15 @@ enum
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_drawable_class_init (GimpDrawableClass *klass);
|
||||
static void gimp_drawable_init (GimpDrawable *drawable);
|
||||
static void gimp_drawable_class_init (GimpDrawableClass *klass);
|
||||
static void gimp_drawable_init (GimpDrawable *drawable);
|
||||
|
||||
static void gimp_drawable_finalize (GObject *object);
|
||||
static void gimp_drawable_finalize (GObject *object);
|
||||
|
||||
static void gimp_drawable_name_changed (GimpObject *drawable);
|
||||
static void gimp_drawable_invalidate_preview (GimpViewable *viewable);
|
||||
static void gimp_drawable_name_changed (GimpObject *object);
|
||||
static gsize gimp_drawable_get_memsize (GimpObject *object);
|
||||
|
||||
static void gimp_drawable_invalidate_preview (GimpViewable *viewable);
|
||||
|
||||
|
||||
/* private variables */
|
||||
@ -143,6 +145,7 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
|
||||
object_class->finalize = gimp_drawable_finalize;
|
||||
|
||||
gimp_object_class->name_changed = gimp_drawable_name_changed;
|
||||
gimp_object_class->get_memsize = gimp_drawable_get_memsize;
|
||||
|
||||
viewable_class->invalidate_preview = gimp_drawable_invalidate_preview;
|
||||
viewable_class->get_preview = gimp_drawable_get_preview;
|
||||
@ -304,6 +307,25 @@ gimp_drawable_name_changed (GimpObject *object)
|
||||
}
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_drawable_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
gsize memsize = 0;
|
||||
|
||||
drawable = GIMP_DRAWABLE (object);
|
||||
|
||||
if (drawable->tiles)
|
||||
memsize += tile_manager_get_memsize (drawable->tiles);
|
||||
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (drawable->parasites));
|
||||
|
||||
if (drawable->preview_cache)
|
||||
memsize += gimp_preview_cache_get_memsize (drawable->preview_cache);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_invalidate_preview (GimpViewable *viewable)
|
||||
{
|
||||
|
||||
@ -47,6 +47,8 @@ static void gimp_gradient_init (GimpGradient *gradient);
|
||||
|
||||
static void gimp_gradient_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_gradient_get_memsize (GimpObject *object);
|
||||
|
||||
static TempBuf * gimp_gradient_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
@ -102,17 +104,21 @@ static void
|
||||
gimp_gradient_class_init (GimpGradientClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
GimpDataClass *data_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_gradient_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_gradient_get_memsize;
|
||||
|
||||
viewable_class->get_new_preview = gimp_gradient_get_new_preview;
|
||||
|
||||
data_class->dirty = gimp_gradient_dirty;
|
||||
@ -144,6 +150,23 @@ gimp_gradient_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_gradient_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpGradient *gradient;
|
||||
GimpGradientSegment *segment;
|
||||
gsize memsize = 0;
|
||||
|
||||
gradient = GIMP_GRADIENT (object);
|
||||
|
||||
for (segment = gradient->segments; segment; segment = segment->next)
|
||||
{
|
||||
memsize += sizeof (GimpGradientSegment);
|
||||
}
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_gradient_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
|
||||
@ -98,6 +98,7 @@ static void gimp_image_dispose (GObject *object);
|
||||
static void gimp_image_finalize (GObject *object);
|
||||
|
||||
static void gimp_image_name_changed (GimpObject *object);
|
||||
static gsize gimp_image_get_memsize (GimpObject *object);
|
||||
|
||||
static void gimp_image_invalidate_preview (GimpViewable *viewable);
|
||||
static void gimp_image_size_changed (GimpViewable *viewable);
|
||||
@ -353,6 +354,7 @@ gimp_image_class_init (GimpImageClass *klass)
|
||||
object_class->finalize = gimp_image_finalize;
|
||||
|
||||
gimp_object_class->name_changed = gimp_image_name_changed;
|
||||
gimp_object_class->get_memsize = gimp_image_get_memsize;
|
||||
|
||||
viewable_class->invalidate_preview = gimp_image_invalidate_preview;
|
||||
viewable_class->size_changed = gimp_image_size_changed;
|
||||
@ -561,6 +563,52 @@ gimp_image_name_changed (GimpObject *object)
|
||||
}
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_image_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
gsize memsize = 0;
|
||||
|
||||
gimage = GIMP_IMAGE (object);
|
||||
|
||||
if (gimage->cmap)
|
||||
memsize += COLORMAP_SIZE;
|
||||
|
||||
if (gimage->shadow)
|
||||
memsize += tile_manager_get_memsize (gimage->shadow);
|
||||
|
||||
if (gimage->projection)
|
||||
memsize += tile_manager_get_memsize (gimage->projection);
|
||||
|
||||
memsize += (g_list_length (gimage->guides) * (sizeof (GList) +
|
||||
sizeof (GimpGuide)));
|
||||
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->layers));
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->channels));
|
||||
|
||||
memsize += g_slist_length (gimage->layer_stack) * sizeof (GSList);
|
||||
|
||||
if (gimage->selection_mask)
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->selection_mask));
|
||||
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->parasites));
|
||||
|
||||
/* FIXME paths */
|
||||
|
||||
memsize += g_slist_length (gimage->undo_stack) * (3 * sizeof (gint) +
|
||||
4 * sizeof (gpointer)); /* FIXME */
|
||||
memsize += g_slist_length (gimage->redo_stack) * (3 * sizeof (gint) +
|
||||
4 * sizeof (gpointer)); /* FIXME */
|
||||
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->new_undo_stack));
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->new_redo_stack));
|
||||
|
||||
if (gimage->comp_preview)
|
||||
memsize += temp_buf_get_memsize (gimage->comp_preview);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_invalidate_preview (GimpViewable *viewable)
|
||||
{
|
||||
|
||||
@ -62,18 +62,20 @@ enum
|
||||
};
|
||||
|
||||
|
||||
static void gimp_layer_class_init (GimpLayerClass *klass);
|
||||
static void gimp_layer_init (GimpLayer *layer);
|
||||
static void gimp_layer_class_init (GimpLayerClass *klass);
|
||||
static void gimp_layer_init (GimpLayer *layer);
|
||||
|
||||
static void gimp_layer_finalize (GObject *object);
|
||||
static void gimp_layer_finalize (GObject *object);
|
||||
|
||||
static void gimp_layer_invalidate_preview (GimpViewable *viewable);
|
||||
static gsize gimp_layer_get_memsize (GimpObject *object);
|
||||
|
||||
static void gimp_layer_transform_color (GimpImage *gimage,
|
||||
PixelRegion *layerPR,
|
||||
PixelRegion *bufPR,
|
||||
GimpDrawable *drawable,
|
||||
GimpImageBaseType type);
|
||||
static void gimp_layer_invalidate_preview (GimpViewable *viewable);
|
||||
|
||||
static void gimp_layer_transform_color (GimpImage *gimage,
|
||||
PixelRegion *layerPR,
|
||||
PixelRegion *bufPR,
|
||||
GimpDrawable *drawable,
|
||||
GimpImageBaseType type);
|
||||
|
||||
|
||||
static guint layer_signals[LAST_SIGNAL] = { 0 };
|
||||
@ -113,10 +115,12 @@ static void
|
||||
gimp_layer_class_init (GimpLayerClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
@ -167,6 +171,8 @@ gimp_layer_class_init (GimpLayerClass *klass)
|
||||
|
||||
object_class->finalize = gimp_layer_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_layer_get_memsize;
|
||||
|
||||
viewable_class->invalidate_preview = gimp_layer_invalidate_preview;
|
||||
|
||||
klass->mask_changed = NULL;
|
||||
@ -223,6 +229,25 @@ gimp_layer_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_layer_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpLayer *layer;
|
||||
gsize memsize = 0;
|
||||
|
||||
layer = GIMP_LAYER (object);
|
||||
|
||||
if (layer->mask)
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (layer->mask));
|
||||
|
||||
if (layer->fs.backing_store)
|
||||
memsize += tile_manager_get_memsize (layer->fs.backing_store);
|
||||
|
||||
memsize += layer->fs.num_segs * sizeof (BoundSeg);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_layer_invalidate_preview (GimpViewable *viewable)
|
||||
{
|
||||
|
||||
@ -35,6 +35,8 @@ static void gimp_list_init (GimpList *list);
|
||||
|
||||
static void gimp_list_dispose (GObject *object);
|
||||
|
||||
static gsize gimp_list_get_memsize (GimpObject *object);
|
||||
|
||||
static void gimp_list_add (GimpContainer *container,
|
||||
GimpObject *object);
|
||||
static void gimp_list_remove (GimpContainer *container,
|
||||
@ -90,15 +92,19 @@ static void
|
||||
gimp_list_class_init (GimpListClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpContainerClass *container_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
container_class = GIMP_CONTAINER_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
container_class = GIMP_CONTAINER_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->dispose = gimp_list_dispose;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_list_get_memsize;
|
||||
|
||||
container_class->add = gimp_list_add;
|
||||
container_class->remove = gimp_list_remove;
|
||||
container_class->reorder = gimp_list_reorder;
|
||||
@ -131,6 +137,31 @@ gimp_list_dispose (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_list_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpList *gimp_list;
|
||||
gsize memsize = 0;
|
||||
|
||||
gimp_list = GIMP_LIST (object);
|
||||
|
||||
memsize += (gimp_container_num_children (GIMP_CONTAINER (gimp_list)) *
|
||||
sizeof (GList));
|
||||
|
||||
if (gimp_container_policy (GIMP_CONTAINER (gimp_list)) ==
|
||||
GIMP_CONTAINER_POLICY_STRONG)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
for (list = gimp_list->list; list; list = g_list_next (list))
|
||||
{
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (list->data));
|
||||
}
|
||||
}
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_list_add (GimpContainer *container,
|
||||
GimpObject *object)
|
||||
|
||||
@ -42,10 +42,12 @@ enum
|
||||
};
|
||||
|
||||
|
||||
static void gimp_module_info_class_init (GimpModuleInfoObjClass *klass);
|
||||
static void gimp_module_info_init (GimpModuleInfoObj *mod);
|
||||
static void gimp_module_info_class_init (GimpModuleInfoObjClass *klass);
|
||||
static void gimp_module_info_init (GimpModuleInfoObj *mod);
|
||||
|
||||
static void gimp_module_info_finalize (GObject *object);
|
||||
static void gimp_module_info_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_module_info_get_memsize (GimpObject *object);
|
||||
|
||||
|
||||
static guint module_info_signals[LAST_SIGNAL];
|
||||
@ -84,9 +86,11 @@ gimp_module_info_get_type (void)
|
||||
static void
|
||||
gimp_module_info_class_init (GimpModuleInfoObjClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
@ -99,9 +103,11 @@ gimp_module_info_class_init (GimpModuleInfoObjClass *klass)
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
object_class->finalize = gimp_module_info_finalize;
|
||||
object_class->finalize = gimp_module_info_finalize;
|
||||
|
||||
klass->modified = NULL;
|
||||
gimp_object_class->get_memsize = gimp_module_info_get_memsize;
|
||||
|
||||
klass->modified = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -145,6 +151,20 @@ gimp_module_info_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_module_info_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpModuleInfoObj *module_info;
|
||||
gsize memsize = 0;
|
||||
|
||||
module_info = GIMP_MODULE_INFO (object);
|
||||
|
||||
if (module_info->fullpath)
|
||||
memsize += strlen (module_info->fullpath) + 1;
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
GimpModuleInfoObj *
|
||||
gimp_module_info_new (const gchar *filename)
|
||||
{
|
||||
|
||||
@ -42,20 +42,20 @@ enum
|
||||
};
|
||||
|
||||
|
||||
static void gimp_object_class_init (GimpObjectClass *klass);
|
||||
static void gimp_object_init (GimpObject *object);
|
||||
static void gimp_object_class_init (GimpObjectClass *klass);
|
||||
static void gimp_object_init (GimpObject *object);
|
||||
|
||||
static void gimp_object_dispose (GObject *object);
|
||||
static void gimp_object_finalize (GObject *object);
|
||||
|
||||
static void gimp_object_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_object_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_object_dispose (GObject *object);
|
||||
static void gimp_object_finalize (GObject *object);
|
||||
static void gimp_object_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_object_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static gsize gimp_object_real_get_memsize (GimpObject *object);
|
||||
|
||||
|
||||
static guint object_signals[LAST_SIGNAL] = { 0 };
|
||||
@ -125,6 +125,7 @@ gimp_object_class_init (GimpObjectClass *klass)
|
||||
|
||||
klass->disconnect = NULL;
|
||||
klass->name_changed = NULL;
|
||||
klass->get_memsize = gimp_object_real_get_memsize;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_NAME,
|
||||
@ -235,7 +236,7 @@ gimp_object_set_name (GimpObject *object,
|
||||
}
|
||||
|
||||
const gchar *
|
||||
gimp_object_get_name (const GimpObject *object)
|
||||
gimp_object_get_name (const GimpObject *object)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_OBJECT (object), NULL);
|
||||
|
||||
@ -243,9 +244,80 @@ gimp_object_get_name (const GimpObject *object)
|
||||
}
|
||||
|
||||
void
|
||||
gimp_object_name_changed (GimpObject *object)
|
||||
gimp_object_name_changed (GimpObject *object)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_OBJECT (object));
|
||||
|
||||
g_signal_emit (G_OBJECT (object), object_signals[NAME_CHANGED], 0);
|
||||
}
|
||||
|
||||
gsize
|
||||
gimp_object_get_memsize (GimpObject *object)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_OBJECT (object), 0);
|
||||
|
||||
#define DEBUG_MEMSIZE 1
|
||||
|
||||
#ifdef DEBUG_MEMSIZE
|
||||
{
|
||||
static gint indent_level = 0;
|
||||
static GList *aggregation_tree = NULL;
|
||||
static gchar indent_buf[256];
|
||||
|
||||
gsize memsize;
|
||||
gint i;
|
||||
gint my_indent_level;
|
||||
gchar *object_size;
|
||||
|
||||
indent_level++;
|
||||
|
||||
my_indent_level = indent_level;
|
||||
|
||||
memsize = GIMP_OBJECT_GET_CLASS (object)->get_memsize (object);
|
||||
|
||||
indent_level--;
|
||||
|
||||
for (i = 0; i < MIN (my_indent_level * 2, sizeof (indent_buf) - 1); i++)
|
||||
indent_buf[i] = ' ';
|
||||
|
||||
indent_buf[i] = '\0';
|
||||
|
||||
object_size = g_strdup_printf ("%s%s \"%s\": %d\n",
|
||||
indent_buf,
|
||||
g_type_name (G_TYPE_FROM_INSTANCE (object)),
|
||||
object->name,
|
||||
memsize);
|
||||
|
||||
aggregation_tree = g_list_prepend (aggregation_tree, object_size);
|
||||
|
||||
if (indent_level == 0)
|
||||
{
|
||||
g_list_foreach (aggregation_tree, g_print, NULL);
|
||||
g_list_foreach (aggregation_tree, g_free, NULL);
|
||||
g_list_free (aggregation_tree);
|
||||
|
||||
aggregation_tree = NULL;
|
||||
}
|
||||
|
||||
return memsize;
|
||||
}
|
||||
#endif /* DEBUG_MEMSIZE */
|
||||
|
||||
return GIMP_OBJECT_GET_CLASS (object)->get_memsize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_object_real_get_memsize (GimpObject *object)
|
||||
{
|
||||
GTypeQuery type_query;
|
||||
gsize memsize = 0;
|
||||
|
||||
g_type_query (G_TYPE_FROM_INSTANCE (object), &type_query);
|
||||
|
||||
memsize += type_query.instance_size;
|
||||
|
||||
if (object->name)
|
||||
memsize += strlen (object->name) + 1;
|
||||
|
||||
return memsize;
|
||||
}
|
||||
|
||||
@ -41,8 +41,12 @@ struct _GimpObjectClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* disconnect) (GimpObject *object);
|
||||
void (* name_changed) (GimpObject *object);
|
||||
/* signals */
|
||||
void (* disconnect) (GimpObject *object);
|
||||
void (* name_changed) (GimpObject *object);
|
||||
|
||||
/* virtual functions */
|
||||
gsize (* get_memsize) (GimpObject *object);
|
||||
};
|
||||
|
||||
|
||||
@ -53,5 +57,7 @@ void gimp_object_set_name (GimpObject *object,
|
||||
const gchar * gimp_object_get_name (const GimpObject *object);
|
||||
void gimp_object_name_changed (GimpObject *object);
|
||||
|
||||
gsize gimp_object_get_memsize (GimpObject *object);
|
||||
|
||||
|
||||
#endif /* __GIMP_OBJECT_H__ */
|
||||
|
||||
@ -46,6 +46,8 @@ static void gimp_palette_init (GimpPalette *palette);
|
||||
|
||||
static void gimp_palette_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_palette_get_memsize (GimpObject *object);
|
||||
|
||||
static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
@ -93,17 +95,21 @@ static void
|
||||
gimp_palette_class_init (GimpPaletteClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
GimpDataClass *data_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_palette_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_palette_get_memsize;
|
||||
|
||||
viewable_class->get_new_preview = gimp_palette_get_new_preview;
|
||||
|
||||
data_class->dirty = gimp_palette_dirty;
|
||||
@ -138,6 +144,30 @@ gimp_palette_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_palette_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpPalette *palette;
|
||||
GList *list;
|
||||
gsize memsize = 0;
|
||||
|
||||
palette = GIMP_PALETTE (object);
|
||||
|
||||
for (list = palette->colors; list; list = g_list_next (list))
|
||||
{
|
||||
GimpPaletteEntry *entry;
|
||||
|
||||
entry = (GimpPaletteEntry *) list->data;
|
||||
|
||||
memsize += sizeof (GList) + sizeof (GimpPaletteEntry);
|
||||
|
||||
if (entry->name)
|
||||
memsize += strlen (entry->name) + 1;
|
||||
}
|
||||
|
||||
return memsize += GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_palette_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
|
||||
@ -46,6 +46,8 @@ static void gimp_palette_init (GimpPalette *palette);
|
||||
|
||||
static void gimp_palette_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_palette_get_memsize (GimpObject *object);
|
||||
|
||||
static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
@ -93,17 +95,21 @@ static void
|
||||
gimp_palette_class_init (GimpPaletteClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
GimpDataClass *data_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_palette_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_palette_get_memsize;
|
||||
|
||||
viewable_class->get_new_preview = gimp_palette_get_new_preview;
|
||||
|
||||
data_class->dirty = gimp_palette_dirty;
|
||||
@ -138,6 +144,30 @@ gimp_palette_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_palette_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpPalette *palette;
|
||||
GList *list;
|
||||
gsize memsize = 0;
|
||||
|
||||
palette = GIMP_PALETTE (object);
|
||||
|
||||
for (list = palette->colors; list; list = g_list_next (list))
|
||||
{
|
||||
GimpPaletteEntry *entry;
|
||||
|
||||
entry = (GimpPaletteEntry *) list->data;
|
||||
|
||||
memsize += sizeof (GList) + sizeof (GimpPaletteEntry);
|
||||
|
||||
if (entry->name)
|
||||
memsize += strlen (entry->name) + 1;
|
||||
}
|
||||
|
||||
return memsize += GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_palette_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
|
||||
@ -46,6 +46,8 @@ static void gimp_palette_init (GimpPalette *palette);
|
||||
|
||||
static void gimp_palette_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_palette_get_memsize (GimpObject *object);
|
||||
|
||||
static TempBuf * gimp_palette_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
@ -93,17 +95,21 @@ static void
|
||||
gimp_palette_class_init (GimpPaletteClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
GimpDataClass *data_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_palette_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_palette_get_memsize;
|
||||
|
||||
viewable_class->get_new_preview = gimp_palette_get_new_preview;
|
||||
|
||||
data_class->dirty = gimp_palette_dirty;
|
||||
@ -138,6 +144,30 @@ gimp_palette_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_palette_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpPalette *palette;
|
||||
GList *list;
|
||||
gsize memsize = 0;
|
||||
|
||||
palette = GIMP_PALETTE (object);
|
||||
|
||||
for (list = palette->colors; list; list = g_list_next (list))
|
||||
{
|
||||
GimpPaletteEntry *entry;
|
||||
|
||||
entry = (GimpPaletteEntry *) list->data;
|
||||
|
||||
memsize += sizeof (GList) + sizeof (GimpPaletteEntry);
|
||||
|
||||
if (entry->name)
|
||||
memsize += strlen (entry->name) + 1;
|
||||
}
|
||||
|
||||
return memsize += GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_palette_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
|
||||
@ -37,14 +37,16 @@ enum
|
||||
};
|
||||
|
||||
|
||||
static void gimp_parasite_list_class_init (GimpParasiteListClass *klass);
|
||||
static void gimp_parasite_list_init (GimpParasiteList *list);
|
||||
static void gimp_parasite_list_class_init (GimpParasiteListClass *klass);
|
||||
static void gimp_parasite_list_init (GimpParasiteList *list);
|
||||
|
||||
static void gimp_parasite_list_finalize (GObject *object);
|
||||
static void gimp_parasite_list_finalize (GObject *object);
|
||||
|
||||
static gint free_a_parasite (gpointer key,
|
||||
gpointer parasite,
|
||||
gpointer unused);
|
||||
static gsize gimp_parasite_list_get_memsize (GimpObject *object);
|
||||
|
||||
static gint free_a_parasite (gpointer key,
|
||||
gpointer parasite,
|
||||
gpointer unused);
|
||||
|
||||
|
||||
static guint parasite_list_signals[LAST_SIGNAL] = { 0 };
|
||||
@ -83,9 +85,11 @@ gimp_parasite_list_get_type (void)
|
||||
static void
|
||||
gimp_parasite_list_class_init (GimpParasiteListClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
@ -109,10 +113,12 @@ gimp_parasite_list_class_init (GimpParasiteListClass *klass)
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
object_class->finalize = gimp_parasite_list_finalize;
|
||||
object_class->finalize = gimp_parasite_list_finalize;
|
||||
|
||||
klass->add = NULL;
|
||||
klass->remove = NULL;
|
||||
gimp_object_class->get_memsize = gimp_parasite_list_get_memsize;
|
||||
|
||||
klass->add = NULL;
|
||||
klass->remove = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -121,16 +127,6 @@ gimp_parasite_list_init (GimpParasiteList *list)
|
||||
list->table = NULL;
|
||||
}
|
||||
|
||||
GimpParasiteList *
|
||||
gimp_parasite_list_new (void)
|
||||
{
|
||||
GimpParasiteList *list;
|
||||
|
||||
list = g_object_new (GIMP_TYPE_PARASITE_LIST, NULL);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_parasite_list_finalize (GObject *object)
|
||||
{
|
||||
@ -150,10 +146,57 @@ gimp_parasite_list_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_parasite_list_get_memsize_foreach (gpointer key,
|
||||
gpointer p,
|
||||
gpointer m)
|
||||
{
|
||||
GimpParasite *parasite;
|
||||
gsize *memsize;
|
||||
|
||||
parasite = (GimpParasite *) p;
|
||||
memsize = (gsize *) m;
|
||||
|
||||
*memsize += (sizeof (GimpParasite) +
|
||||
strlen (parasite->name) + 1 +
|
||||
parasite->size);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_parasite_list_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpParasiteList *list;
|
||||
gsize memsize = 0;
|
||||
|
||||
list = GIMP_PARASITE_LIST (object);
|
||||
|
||||
if (list->table)
|
||||
{
|
||||
memsize += (g_hash_table_size (list->table) *
|
||||
3 * sizeof (gpointer)); /* FIXME */
|
||||
|
||||
g_hash_table_foreach (list->table,
|
||||
gimp_parasite_list_get_memsize_foreach,
|
||||
&memsize);
|
||||
}
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
GimpParasiteList *
|
||||
gimp_parasite_list_new (void)
|
||||
{
|
||||
GimpParasiteList *list;
|
||||
|
||||
list = g_object_new (GIMP_TYPE_PARASITE_LIST, NULL);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
static gint
|
||||
free_a_parasite (void *key,
|
||||
void *parasite,
|
||||
void *unused)
|
||||
free_a_parasite (gpointer key,
|
||||
gpointer parasite,
|
||||
gpointer unused)
|
||||
{
|
||||
gimp_parasite_free ((GimpParasite *) parasite);
|
||||
|
||||
@ -162,13 +205,11 @@ free_a_parasite (void *key,
|
||||
|
||||
static void
|
||||
parasite_copy_one (gpointer key,
|
||||
gpointer p,
|
||||
gpointer data)
|
||||
gpointer parasite,
|
||||
gpointer list)
|
||||
{
|
||||
GimpParasiteList *list = (GimpParasiteList *) data;
|
||||
GimpParasite *parasite = (GimpParasite *) p;
|
||||
|
||||
gimp_parasite_list_add (list, parasite);
|
||||
gimp_parasite_list_add ((GimpParasiteList *) list,
|
||||
(GimpParasite *) parasite);
|
||||
}
|
||||
|
||||
GimpParasiteList *
|
||||
|
||||
@ -57,6 +57,8 @@ static void gimp_pattern_init (GimpPattern *pattern);
|
||||
|
||||
static void gimp_pattern_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_pattern_get_memsize (GimpObject *object);
|
||||
|
||||
static TempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
@ -99,17 +101,21 @@ static void
|
||||
gimp_pattern_class_init (GimpPatternClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
GimpDataClass *data_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_pattern_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_pattern_get_memsize;
|
||||
|
||||
viewable_class->get_new_preview = gimp_pattern_get_new_preview;
|
||||
|
||||
data_class->get_extension = gimp_pattern_get_extension;
|
||||
@ -138,6 +144,20 @@ gimp_pattern_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_pattern_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpPattern *pattern;
|
||||
gsize memsize = 0;
|
||||
|
||||
pattern = GIMP_PATTERN (object);
|
||||
|
||||
if (pattern->mask)
|
||||
memsize += temp_buf_get_memsize (pattern->mask);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_pattern_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
|
||||
@ -57,6 +57,8 @@ static void gimp_pattern_init (GimpPattern *pattern);
|
||||
|
||||
static void gimp_pattern_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_pattern_get_memsize (GimpObject *object);
|
||||
|
||||
static TempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
@ -99,17 +101,21 @@ static void
|
||||
gimp_pattern_class_init (GimpPatternClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
GimpDataClass *data_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
data_class = GIMP_DATA_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_pattern_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_pattern_get_memsize;
|
||||
|
||||
viewable_class->get_new_preview = gimp_pattern_get_new_preview;
|
||||
|
||||
data_class->get_extension = gimp_pattern_get_extension;
|
||||
@ -138,6 +144,20 @@ gimp_pattern_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_pattern_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpPattern *pattern;
|
||||
gsize memsize = 0;
|
||||
|
||||
pattern = GIMP_PATTERN (object);
|
||||
|
||||
if (pattern->mask)
|
||||
memsize += temp_buf_get_memsize (pattern->mask);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_pattern_get_new_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
|
||||
@ -323,3 +323,24 @@ gimp_preview_cache_get (GSList **plist,
|
||||
/* g_print ("gimp_preview_cache_get returning NULL\n"); */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gsize
|
||||
gimp_preview_cache_get_memsize (GSList *cache)
|
||||
{
|
||||
GSList *list;
|
||||
gsize memsize = 0;
|
||||
|
||||
g_return_val_if_fail (cache != NULL, 0);
|
||||
|
||||
for (list = cache; list; list = g_slist_next (list))
|
||||
{
|
||||
PreviewCache *pc;
|
||||
|
||||
pc = (PreviewCache *) list->data;
|
||||
|
||||
memsize += (sizeof (PreviewCache) +
|
||||
temp_buf_get_memsize (pc->preview));
|
||||
}
|
||||
|
||||
return memsize;
|
||||
}
|
||||
|
||||
@ -24,12 +24,14 @@
|
||||
#define PREVIEW_CACHE_PRIME_HEIGHT 112
|
||||
|
||||
|
||||
TempBuf * gimp_preview_cache_get (GSList **plist,
|
||||
gint width,
|
||||
gint height);
|
||||
void gimp_preview_cache_add (GSList **plist,
|
||||
TempBuf *buf);
|
||||
void gimp_preview_cache_invalidate (GSList **plist);
|
||||
TempBuf * gimp_preview_cache_get (GSList **plist,
|
||||
gint width,
|
||||
gint height);
|
||||
void gimp_preview_cache_add (GSList **plist,
|
||||
TempBuf *buf);
|
||||
void gimp_preview_cache_invalidate (GSList **plist);
|
||||
|
||||
gsize gimp_preview_cache_get_memsize (GSList *cache);
|
||||
|
||||
|
||||
#endif /* __GIMP_PREVIEW_CACHE_H__ */
|
||||
|
||||
@ -42,13 +42,16 @@ static void gimp_undo_init (GimpUndo *undo);
|
||||
|
||||
static void gimp_undo_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_undo_get_memsize (GimpObject *object);
|
||||
|
||||
static TempBuf * gimp_undo_get_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
static void gimp_undo_real_push (GimpUndo *undo,
|
||||
GimpImage *gimage);
|
||||
static void gimp_undo_real_pop (GimpUndo *undo,
|
||||
GimpImage *gimage);
|
||||
static TempBuf * gimp_undo_get_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
|
||||
static guint undo_signals[LAST_SIGNAL] = { 0 };
|
||||
@ -88,10 +91,12 @@ static void
|
||||
gimp_undo_class_init (GimpUndoClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
@ -115,19 +120,20 @@ gimp_undo_class_init (GimpUndoClass *klass)
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
object_class->finalize = gimp_undo_finalize;
|
||||
object_class->finalize = gimp_undo_finalize;
|
||||
|
||||
viewable_class->get_preview = gimp_undo_get_preview;
|
||||
gimp_object_class->get_memsize = gimp_undo_get_memsize;
|
||||
|
||||
klass->push = gimp_undo_real_push;
|
||||
klass->pop = gimp_undo_real_pop;
|
||||
viewable_class->get_preview = gimp_undo_get_preview;
|
||||
|
||||
klass->push = gimp_undo_real_push;
|
||||
klass->pop = gimp_undo_real_pop;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_undo_init (GimpUndo *undo)
|
||||
{
|
||||
undo->data = NULL;
|
||||
undo->size = 0;
|
||||
undo->dirties_image = FALSE;
|
||||
undo->pop_func = NULL;
|
||||
undo->free_func = NULL;
|
||||
@ -156,10 +162,31 @@ gimp_undo_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_undo_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpUndo *undo;
|
||||
gsize memsize = 0;
|
||||
|
||||
undo = GIMP_UNDO (object);
|
||||
|
||||
if (undo->preview)
|
||||
memsize += temp_buf_get_memsize (undo->preview);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_undo_get_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
return (GIMP_UNDO (viewable)->preview);
|
||||
}
|
||||
|
||||
GimpUndo *
|
||||
gimp_undo_new (const gchar *name,
|
||||
gpointer data,
|
||||
glong size,
|
||||
gboolean dirties_image,
|
||||
GimpUndoPopFunc pop_func,
|
||||
GimpUndoFreeFunc free_func)
|
||||
@ -171,7 +198,6 @@ gimp_undo_new (const gchar *name,
|
||||
gimp_object_set_name (GIMP_OBJECT (undo), name);
|
||||
|
||||
undo->data = data;
|
||||
undo->size = sizeof (GimpUndo) + size;
|
||||
|
||||
undo->pop_func = pop_func;
|
||||
undo->free_func = free_func;
|
||||
@ -219,11 +245,3 @@ gimp_undo_real_pop (GimpUndo *undo,
|
||||
if (undo->pop_func)
|
||||
undo->pop_func (undo, gimage);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
gimp_undo_get_preview (GimpViewable *viewable,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
return (GIMP_UNDO (viewable)->preview);
|
||||
}
|
||||
|
||||
@ -42,7 +42,6 @@ struct _GimpUndo
|
||||
GimpViewable parent_instance;
|
||||
|
||||
gpointer data; /* data to implement the undo */
|
||||
glong size; /* size of undo item */
|
||||
gboolean dirties_image; /* TRUE if undo mutates image */
|
||||
|
||||
GimpUndoPopFunc pop_func; /* function pointer to undo pop proc */
|
||||
@ -65,7 +64,6 @@ struct _GimpUndoClass
|
||||
GType gimp_undo_get_type (void) G_GNUC_CONST;
|
||||
GimpUndo * gimp_undo_new (const gchar *name,
|
||||
gpointer data,
|
||||
glong size,
|
||||
gboolean dirties_image,
|
||||
GimpUndoPopFunc pop_func,
|
||||
GimpUndoFreeFunc free_func);
|
||||
|
||||
@ -28,17 +28,19 @@
|
||||
#include "gimpundostack.h"
|
||||
|
||||
|
||||
static void gimp_undo_stack_class_init (GimpUndoStackClass *klass);
|
||||
static void gimp_undo_stack_init (GimpUndoStack *stack);
|
||||
static void gimp_undo_stack_class_init (GimpUndoStackClass *klass);
|
||||
static void gimp_undo_stack_init (GimpUndoStack *stack);
|
||||
|
||||
static void gimp_undo_stack_finalize (GObject *object);
|
||||
static void gimp_undo_stack_finalize (GObject *object);
|
||||
|
||||
static void gimp_undo_stack_add_callback (GimpContainer *container,
|
||||
GimpObject *object,
|
||||
gpointer data);
|
||||
static void gimp_undo_stack_remove_callback (GimpContainer *container,
|
||||
GimpObject *object,
|
||||
gpointer data);
|
||||
static gsize gimp_undo_stack_get_memsize (GimpObject *object);
|
||||
|
||||
static void gimp_undo_stack_add_callback (GimpContainer *container,
|
||||
GimpObject *object,
|
||||
gpointer data);
|
||||
static void gimp_undo_stack_remove_callback (GimpContainer *container,
|
||||
GimpObject *object,
|
||||
gpointer data);
|
||||
|
||||
|
||||
static GimpUndoClass *parent_class = NULL;
|
||||
@ -75,13 +77,17 @@ gimp_undo_stack_get_type (void)
|
||||
static void
|
||||
gimp_undo_stack_class_init (GimpUndoStackClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_undo_stack_finalize;
|
||||
object_class->finalize = gimp_undo_stack_finalize;
|
||||
|
||||
gimp_object_class->get_memsize = gimp_undo_stack_get_memsize;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -120,6 +126,20 @@ gimp_undo_stack_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_undo_stack_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpUndoStack *stack;
|
||||
gsize memsize = 0;
|
||||
|
||||
stack = GIMP_UNDO_STACK (object);
|
||||
|
||||
if (stack->undos)
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (stack->undos));
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
GimpUndoStack *
|
||||
gimp_undo_stack_new (GimpImage *gimage)
|
||||
{
|
||||
@ -188,8 +208,6 @@ gimp_undo_stack_add_callback (GimpContainer *container,
|
||||
|
||||
undo = GIMP_UNDO (object);
|
||||
stack = GIMP_UNDO (data);
|
||||
|
||||
stack->size += undo->size;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -202,6 +220,4 @@ gimp_undo_stack_remove_callback (GimpContainer *container,
|
||||
|
||||
undo = GIMP_UNDO (object);
|
||||
stack = GIMP_UNDO (data);
|
||||
|
||||
stack->size -= undo->size;
|
||||
}
|
||||
|
||||
@ -39,10 +39,12 @@ enum
|
||||
};
|
||||
|
||||
|
||||
static void gimp_viewable_class_init (GimpViewableClass *klass);
|
||||
static void gimp_viewable_init (GimpViewable *viewable);
|
||||
static void gimp_viewable_class_init (GimpViewableClass *klass);
|
||||
static void gimp_viewable_init (GimpViewable *viewable);
|
||||
|
||||
static void gimp_viewable_real_invalidate_preview (GimpViewable *viewable);
|
||||
static gsize gimp_viewable_get_memsize (GimpObject *object);
|
||||
|
||||
static void gimp_viewable_real_invalidate_preview (GimpViewable *viewable);
|
||||
|
||||
|
||||
static guint viewable_signals[LAST_SIGNAL] = { 0 };
|
||||
@ -81,6 +83,10 @@ gimp_viewable_get_type (void)
|
||||
static void
|
||||
gimp_viewable_class_init (GimpViewableClass *klass)
|
||||
{
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
viewable_signals[INVALIDATE_PREVIEW] =
|
||||
@ -101,11 +107,13 @@ gimp_viewable_class_init (GimpViewableClass *klass)
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
klass->invalidate_preview = gimp_viewable_real_invalidate_preview;
|
||||
klass->size_changed = NULL;
|
||||
gimp_object_class->get_memsize = gimp_viewable_get_memsize;
|
||||
|
||||
klass->get_preview = NULL;
|
||||
klass->get_new_preview = NULL;
|
||||
klass->invalidate_preview = gimp_viewable_real_invalidate_preview;
|
||||
klass->size_changed = NULL;
|
||||
|
||||
klass->get_preview = NULL;
|
||||
klass->get_new_preview = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -113,6 +121,45 @@ gimp_viewable_init (GimpViewable *viewable)
|
||||
{
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_viewable_get_memsize (GimpObject *object)
|
||||
{
|
||||
TempBuf *temp_buf;
|
||||
GdkPixbuf *pixbuf;
|
||||
gsize memsize = 0;
|
||||
|
||||
temp_buf = g_object_get_data (G_OBJECT (object),
|
||||
"static-viewable-preview");
|
||||
|
||||
pixbuf = g_object_get_data (G_OBJECT (object),
|
||||
"static-viewable-preview-pixbuf");
|
||||
|
||||
if (temp_buf)
|
||||
{
|
||||
memsize += temp_buf_get_memsize (temp_buf);
|
||||
}
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
static gsize pixbuf_instance_size = 0;
|
||||
|
||||
if (! pixbuf_instance_size)
|
||||
{
|
||||
GTypeQuery type_query;
|
||||
|
||||
g_type_query (G_TYPE_FROM_INSTANCE (pixbuf), &type_query);
|
||||
|
||||
pixbuf_instance_size = type_query.instance_size;
|
||||
}
|
||||
|
||||
memsize += (pixbuf_instance_size +
|
||||
gdk_pixbuf_get_height (pixbuf) *
|
||||
gdk_pixbuf_get_rowstride (pixbuf));
|
||||
}
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_viewable_invalidate_preview (GimpViewable *viewable)
|
||||
{
|
||||
|
||||
@ -540,6 +540,15 @@ gimp_preview_button_press_event (GtkWidget *widget,
|
||||
|
||||
preview = GIMP_PREVIEW (widget);
|
||||
|
||||
#define DEBUG_MEMSIZE 1
|
||||
|
||||
#ifdef DEBUG_MEMSIZE
|
||||
if (bevent->type == GDK_BUTTON_PRESS && bevent->button == 2)
|
||||
{
|
||||
gimp_object_get_memsize (GIMP_OBJECT (preview->viewable));
|
||||
}
|
||||
#endif /* DEBUG_MEMSIZE */
|
||||
|
||||
if (! preview->clickable &&
|
||||
! preview->show_popup)
|
||||
return FALSE;
|
||||
|
||||
@ -540,6 +540,15 @@ gimp_preview_button_press_event (GtkWidget *widget,
|
||||
|
||||
preview = GIMP_PREVIEW (widget);
|
||||
|
||||
#define DEBUG_MEMSIZE 1
|
||||
|
||||
#ifdef DEBUG_MEMSIZE
|
||||
if (bevent->type == GDK_BUTTON_PRESS && bevent->button == 2)
|
||||
{
|
||||
gimp_object_get_memsize (GIMP_OBJECT (preview->viewable));
|
||||
}
|
||||
#endif /* DEBUG_MEMSIZE */
|
||||
|
||||
if (! preview->clickable &&
|
||||
! preview->show_popup)
|
||||
return FALSE;
|
||||
|
||||
@ -540,6 +540,15 @@ gimp_preview_button_press_event (GtkWidget *widget,
|
||||
|
||||
preview = GIMP_PREVIEW (widget);
|
||||
|
||||
#define DEBUG_MEMSIZE 1
|
||||
|
||||
#ifdef DEBUG_MEMSIZE
|
||||
if (bevent->type == GDK_BUTTON_PRESS && bevent->button == 2)
|
||||
{
|
||||
gimp_object_get_memsize (GIMP_OBJECT (preview->viewable));
|
||||
}
|
||||
#endif /* DEBUG_MEMSIZE */
|
||||
|
||||
if (! preview->clickable &&
|
||||
! preview->show_popup)
|
||||
return FALSE;
|
||||
|
||||
@ -540,6 +540,15 @@ gimp_preview_button_press_event (GtkWidget *widget,
|
||||
|
||||
preview = GIMP_PREVIEW (widget);
|
||||
|
||||
#define DEBUG_MEMSIZE 1
|
||||
|
||||
#ifdef DEBUG_MEMSIZE
|
||||
if (bevent->type == GDK_BUTTON_PRESS && bevent->button == 2)
|
||||
{
|
||||
gimp_object_get_memsize (GIMP_OBJECT (preview->viewable));
|
||||
}
|
||||
#endif /* DEBUG_MEMSIZE */
|
||||
|
||||
if (! preview->clickable &&
|
||||
! preview->show_popup)
|
||||
return FALSE;
|
||||
|
||||
@ -42,10 +42,12 @@ enum
|
||||
};
|
||||
|
||||
|
||||
static void gimp_module_info_class_init (GimpModuleInfoObjClass *klass);
|
||||
static void gimp_module_info_init (GimpModuleInfoObj *mod);
|
||||
static void gimp_module_info_class_init (GimpModuleInfoObjClass *klass);
|
||||
static void gimp_module_info_init (GimpModuleInfoObj *mod);
|
||||
|
||||
static void gimp_module_info_finalize (GObject *object);
|
||||
static void gimp_module_info_finalize (GObject *object);
|
||||
|
||||
static gsize gimp_module_info_get_memsize (GimpObject *object);
|
||||
|
||||
|
||||
static guint module_info_signals[LAST_SIGNAL];
|
||||
@ -84,9 +86,11 @@ gimp_module_info_get_type (void)
|
||||
static void
|
||||
gimp_module_info_class_init (GimpModuleInfoObjClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
@ -99,9 +103,11 @@ gimp_module_info_class_init (GimpModuleInfoObjClass *klass)
|
||||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
object_class->finalize = gimp_module_info_finalize;
|
||||
object_class->finalize = gimp_module_info_finalize;
|
||||
|
||||
klass->modified = NULL;
|
||||
gimp_object_class->get_memsize = gimp_module_info_get_memsize;
|
||||
|
||||
klass->modified = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -145,6 +151,20 @@ gimp_module_info_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gsize
|
||||
gimp_module_info_get_memsize (GimpObject *object)
|
||||
{
|
||||
GimpModuleInfoObj *module_info;
|
||||
gsize memsize = 0;
|
||||
|
||||
module_info = GIMP_MODULE_INFO (object);
|
||||
|
||||
if (module_info->fullpath)
|
||||
memsize += strlen (module_info->fullpath) + 1;
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
|
||||
}
|
||||
|
||||
GimpModuleInfoObj *
|
||||
gimp_module_info_new (const gchar *filename)
|
||||
{
|
||||
|
||||
@ -224,7 +224,8 @@ gimp_color_area_expose (GtkWidget *widget,
|
||||
|
||||
buf = gca->buf + event->area.y * gca->rowstride + event->area.x * 3;
|
||||
|
||||
gdk_draw_rgb_image_dithalign (widget->window, NULL,
|
||||
gdk_draw_rgb_image_dithalign (widget->window,
|
||||
widget->style->black_gc,
|
||||
event->area.x,
|
||||
event->area.y,
|
||||
event->area.width,
|
||||
@ -232,8 +233,8 @@ gimp_color_area_expose (GtkWidget *widget,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
buf,
|
||||
gca->rowstride,
|
||||
- event->area.x,
|
||||
- event->area.y);
|
||||
event->area.x,
|
||||
event->area.y);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user