Commit 24f3da16 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

changed GimpObject::get_memsize() to return a second value named

2003-08-25  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpobject.[ch]: changed GimpObject::get_memsize() to
	return a second value named "gui_size", where the primary return
	value is the "constant" actual size (as long as no operation is
	performed on the object), and the second "gui_size" return value
	is the size of temporary stuff like preview caches or boundary
	segments (which may change asynchronously, even if the object is
	on the undo stack).

	* 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-undo.c
	* app/core/gimpimage.c
	* app/core/gimpitem.c
	* app/core/gimplayer.c
	* app/core/gimplist.c
	* app/core/gimppalette.c
	* app/core/gimpparasitelist.c
	* app/core/gimppattern.c
	* app/core/gimpundo.c
	* app/core/gimpundostack.c
	* app/core/gimpviewable.c
	* app/text/gimptextlayer.c
	* app/vectors/gimpstroke.c
	* app/vectors/gimpvectors.c: changed get_memsize() implementations
	accordingly.

	* app/display/gimpdisplayshell-title.c
	* app/gui/debug-commands.c
	* app/widgets/gimppreview.c: changed callers accordingly.

	* app/core/gimpimage-undo-push.c: changed layer, channel, vectors
	and layer_mask undo steps to add/subtract the size of the
	resp. objects whenever they take/drop ownership of them. Ignore
	the objects' "gui_size" to get identical sizes on
	adding/subtracting. Fixes bug #120429.
parent 72369061
2003-08-25 Michael Natterer <mitch@gimp.org>
* app/core/gimpobject.[ch]: changed GimpObject::get_memsize() to
return a second value named "gui_size", where the primary return
value is the "constant" actual size (as long as no operation is
performed on the object), and the second "gui_size" return value
is the size of temporary stuff like preview caches or boundary
segments (which may change asynchronously, even if the object is
on the undo stack).
* 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-undo.c
* app/core/gimpimage.c
* app/core/gimpitem.c
* app/core/gimplayer.c
* app/core/gimplist.c
* app/core/gimppalette.c
* app/core/gimpparasitelist.c
* app/core/gimppattern.c
* app/core/gimpundo.c
* app/core/gimpundostack.c
* app/core/gimpviewable.c
* app/text/gimptextlayer.c
* app/vectors/gimpstroke.c
* app/vectors/gimpvectors.c: changed get_memsize() implementations
accordingly.
* app/display/gimpdisplayshell-title.c
* app/gui/debug-commands.c
* app/widgets/gimppreview.c: changed callers accordingly.
* app/core/gimpimage-undo-push.c: changed layer, channel, vectors
and layer_mask undo steps to add/subtract the size of the
resp. objects whenever they take/drop ownership of them. Ignore
the objects' "gui_size" to get identical sizes on
adding/subtracting. Fixes bug #120429.
2003-08-25 Michael Natterer <mitch@gimp.org>
* app/display/gimpnavigationview.c: forgot this one.
......@@ -93,7 +93,7 @@ debug_mem_profile_cmd_callback (GtkWidget *widget,
gimp_debug_memsize = TRUE;
gimp_object_get_memsize (GIMP_OBJECT (data));
gimp_object_get_memsize (GIMP_OBJECT (data), NULL);
gimp_debug_memsize = FALSE;
}
......@@ -111,73 +111,33 @@ debug_dump_menus_recurse_menu (GtkWidget *menu,
GList *list;
const gchar *label;
gchar *help_page;
gchar *help_path;
gchar *factory_path;
gchar *hash;
gchar *full_path;
gchar *format_str;
for (list = GTK_MENU_SHELL (menu)->children; list; list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
if (GTK_IS_LABEL (GTK_BIN (menu_item)->child))
{
label = gtk_label_get_text (GTK_LABEL (GTK_BIN (menu_item)->child));
full_path = g_strconcat (path, "/", label, NULL);
item_factory = GTK_ITEM_FACTORY (gimp_item_factory_from_path (path));
help_page = g_object_get_data (G_OBJECT (menu_item), "help_page");
if (item_factory)
{
factory_path = g_object_get_data (G_OBJECT (item_factory),
"factory_path");
if (factory_path)
{
help_page = g_build_filename (factory_path, help_page, NULL);
}
else
{
help_page = g_strdup (help_page);
}
}
else
{
help_page = g_strdup (help_page);
}
if (help_page)
{
help_path = g_build_filename (gimp_data_directory (),
"help", "C", help_page, NULL);
if ((hash = strchr (help_path, '#')) != NULL)
*hash = '\0';
if (g_file_test (help_path, G_FILE_TEST_EXISTS))
{
g_free (help_path);
help_path = g_strconcat ("! ", help_page, NULL);
g_free (help_page);
help_page = help_path;
}
else
{
g_free (help_path);
}
}
format_str = g_strdup_printf ("%%%ds%%%ds %%-20s %%s\n",
help_page = g_object_get_data (G_OBJECT (menu_item),
"gimp-help-id");
help_page = g_strdup (help_page);
format_str = g_strdup_printf ("%%%ds%%%ds %%-20s %%s\n",
depth * 2, depth * 2 - 40);
g_print (format_str,
g_print (format_str,
"", label, "", help_page ? help_page : "");
g_free (format_str);
g_free (help_page);
if (GTK_MENU_ITEM (menu_item)->submenu)
debug_dump_menus_recurse_menu (GTK_MENU_ITEM (menu_item)->submenu,
debug_dump_menus_recurse_menu (GTK_MENU_ITEM (menu_item)->submenu,
depth + 1, full_path);
g_free (full_path);
......
......@@ -82,7 +82,8 @@ static void gimp_init (Gimp *gimp);
static void gimp_dispose (GObject *object);
static void gimp_finalize (GObject *object);
static gsize gimp_get_memsize (GimpObject *object);
static gsize gimp_get_memsize (GimpObject *object,
gsize *gui_size);
static gboolean gimp_real_exit (Gimp *gimp,
gboolean kill_it);
......@@ -100,7 +101,7 @@ static GimpObjectClass *parent_class = NULL;
static guint gimp_signals[LAST_SIGNAL] = { 0, };
GType
GType
gimp_get_type (void)
{
static GType object_type = 0;
......@@ -121,7 +122,7 @@ gimp_get_type (void)
};
object_type = g_type_register_static (GIMP_TYPE_OBJECT,
"Gimp",
"Gimp",
&object_info, 0);
}
......@@ -202,8 +203,8 @@ gimp_init (Gimp *gimp)
paint_init (gimp);
gimp_modules_init (gimp);
gimp->environ_table = gimp_environ_table_new ();
gimp->environ_table = gimp_environ_table_new ();
gimp->plug_in_debug = NULL;
......@@ -441,7 +442,8 @@ gimp_finalize (GObject *object)
}
static gsize
gimp_get_memsize (GimpObject *object)
gimp_get_memsize (GimpObject *object,
gsize *gui_size)
{
Gimp *gimp;
gsize memsize = 0;
......@@ -450,7 +452,8 @@ gimp_get_memsize (GimpObject *object)
memsize += g_list_length (gimp->user_units) * sizeof (GList); /* FIXME */
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->parasites));
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->parasites),
gui_size);
memsize += gimp_g_object_get_memsize (G_OBJECT (gimp->module_db));
......@@ -459,17 +462,24 @@ gimp_get_memsize (GimpObject *object)
memsize += (g_hash_table_size (gimp->item_table) *
3 * sizeof (gpointer)); /* FIXME */
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->displays));
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->displays), gui_size);
if (gimp->global_buffer)
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->global_buffer));
memsize += (gimp_object_get_memsize (GIMP_OBJECT (gimp->named_buffers)) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->fonts)) +
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 += gimp_object_get_memsize (GIMP_OBJECT (gimp->global_buffer),
gui_size);
memsize += (gimp_object_get_memsize (GIMP_OBJECT (gimp->named_buffers),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->fonts),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->brush_factory),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->pattern_factory),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->gradient_factory),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->palette_factory),
gui_size));
memsize += (g_hash_table_size (gimp->procedural_ht) *
3 * sizeof (gpointer)); /* FIXME */
......@@ -480,19 +490,28 @@ gimp_get_memsize (GimpObject *object)
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)) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->templates)) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->image_new_last_template)));
memsize += (gimp_object_get_memsize (GIMP_OBJECT (gimp->tool_info_list),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->standard_tool_info),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->documents),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->templates),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->image_new_last_template),
gui_size));
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)));
memsize += (gimp_object_get_memsize (GIMP_OBJECT (gimp->standard_context),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->default_context),
gui_size) +
gimp_object_get_memsize (GIMP_OBJECT (gimp->user_context),
gui_size));
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
}
static gboolean
......@@ -759,19 +778,19 @@ gimp_restore (Gimp *gimp,
/* initialize the list of gimp brushes */
(* status_callback) (NULL, _("Brushes"), 0.15);
gimp_data_factory_data_init (gimp->brush_factory, no_data);
gimp_data_factory_data_init (gimp->brush_factory, no_data);
/* initialize the list of gimp patterns */
(* status_callback) (NULL, _("Patterns"), 0.30);
gimp_data_factory_data_init (gimp->pattern_factory, no_data);
gimp_data_factory_data_init (gimp->pattern_factory, no_data);
/* initialize the list of gimp palettes */
(* status_callback) (NULL, _("Palettes"), 0.45);
gimp_data_factory_data_init (gimp->palette_factory, no_data);
gimp_data_factory_data_init (gimp->palette_factory, no_data);
/* initialize the list of gimp gradients */
(* status_callback) (NULL, _("Gradients"), 0.60);
gimp_data_factory_data_init (gimp->gradient_factory, no_data);
gimp_data_factory_data_init (gimp->gradient_factory, no_data);
/* initialize the list of gimp fonts */
(* status_callback) (NULL, _("Fonts"), 0.70);
......
......@@ -69,7 +69,8 @@ static void gimp_brush_init (GimpBrush *brush);
static void gimp_brush_finalize (GObject *object);
static gsize gimp_brush_get_memsize (GimpObject *object);
static gsize gimp_brush_get_memsize (GimpObject *object,
gsize *gui_size);
static gboolean gimp_brush_get_popup_size (GimpViewable *viewable,
gint width,
......@@ -200,7 +201,8 @@ gimp_brush_finalize (GObject *object)
}
static gsize
gimp_brush_get_memsize (GimpObject *object)
gimp_brush_get_memsize (GimpObject *object,
gsize *gui_size)
{
GimpBrush *brush;
gsize memsize = 0;
......@@ -213,7 +215,8 @@ gimp_brush_get_memsize (GimpObject *object)
if (brush->pixmap)
memsize += temp_buf_get_memsize (brush->pixmap);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
}
static gboolean
......
......@@ -69,7 +69,8 @@ static void gimp_brush_init (GimpBrush *brush);
static void gimp_brush_finalize (GObject *object);
static gsize gimp_brush_get_memsize (GimpObject *object);
static gsize gimp_brush_get_memsize (GimpObject *object,
gsize *gui_size);
static gboolean gimp_brush_get_popup_size (GimpViewable *viewable,
gint width,
......@@ -200,7 +201,8 @@ gimp_brush_finalize (GObject *object)
}
static gsize
gimp_brush_get_memsize (GimpObject *object)
gimp_brush_get_memsize (GimpObject *object,
gsize *gui_size)
{
GimpBrush *brush;
gsize memsize = 0;
......@@ -213,7 +215,8 @@ gimp_brush_get_memsize (GimpObject *object)
if (brush->pixmap)
memsize += temp_buf_get_memsize (brush->pixmap);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
}
static gboolean
......
......@@ -58,23 +58,24 @@
static void gimp_brush_pipe_class_init (GimpBrushPipeClass *klass);
static void gimp_brush_pipe_init (GimpBrushPipe *pipe);
static void gimp_brush_pipe_finalize (GObject *object);
static void gimp_brush_pipe_finalize (GObject *object);
static gsize gimp_brush_pipe_get_memsize (GimpObject *object);
static gsize gimp_brush_pipe_get_memsize (GimpObject *object,
gsize *gui_size);
static gboolean gimp_brush_pipe_get_popup_size (GimpViewable *viewable,
gint width,
gint height,
gboolean dot_for_dot,
gint *popup_width,
gint *popup_height);
static gboolean gimp_brush_pipe_get_popup_size (GimpViewable *viewable,
gint width,
gint height,
gboolean dot_for_dot,
gint *popup_width,
gint *popup_height);
static GimpBrush * gimp_brush_pipe_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static gboolean gimp_brush_pipe_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static GimpBrush * gimp_brush_pipe_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static gboolean gimp_brush_pipe_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static GimpBrushClass *parent_class = NULL;
......@@ -101,7 +102,7 @@ gimp_brush_pipe_get_type (void)
};
brush_type = g_type_register_static (GIMP_TYPE_BRUSH,
"GimpBrushPipe",
"GimpBrushPipe",
&brush_info, 0);
}
......@@ -196,7 +197,8 @@ gimp_brush_pipe_finalize (GObject *object)
}
static gsize
gimp_brush_pipe_get_memsize (GimpObject *object)
gimp_brush_pipe_get_memsize (GimpObject *object,
gsize *gui_size)
{
GimpBrushPipe *pipe;
gsize memsize = 0;
......@@ -209,11 +211,11 @@ gimp_brush_pipe_get_memsize (GimpObject *object)
sizeof (PipeSelectModes));
for (i = 0; i < pipe->nbrushes; i++)
{
memsize += gimp_object_get_memsize (GIMP_OBJECT (pipe->brushes[i]));
}
memsize += gimp_object_get_memsize (GIMP_OBJECT (pipe->brushes[i]),
gui_size);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
}
static gboolean
......@@ -358,7 +360,7 @@ gimp_brush_pipe_load (const gchar *filename,
buffer = g_string_new (NULL);
while (read (fd, &c, 1) == 1 && c != '\n' && buffer->len < 1024)
g_string_append_c (buffer, c);
if (buffer->len > 0 && buffer->len < 1024)
{
pipe = GIMP_BRUSH_PIPE (g_object_new (GIMP_TYPE_BRUSH_PIPE, NULL));
......@@ -369,7 +371,7 @@ gimp_brush_pipe_load (const gchar *filename,
}
else
{
g_message (_("Invalid UTF-8 string in brush file '%s'."),
g_message (_("Invalid UTF-8 string in brush file '%s'."),
filename);
gimp_object_set_name (GIMP_OBJECT (pipe), _("Unnamed"));
}
......@@ -496,7 +498,7 @@ gimp_brush_pipe_load (const gchar *filename,
g_object_unref (pipe);
return NULL;
}
pipe->nbrushes++;
}
......
......@@ -58,23 +58,24 @@
static void gimp_brush_pipe_class_init (GimpBrushPipeClass *klass);
static void gimp_brush_pipe_init (GimpBrushPipe *pipe);
static void gimp_brush_pipe_finalize (GObject *object);
static void gimp_brush_pipe_finalize (GObject *object);
static gsize gimp_brush_pipe_get_memsize (GimpObject *object);
static gsize gimp_brush_pipe_get_memsize (GimpObject *object,
gsize *gui_size);
static gboolean gimp_brush_pipe_get_popup_size (GimpViewable *viewable,
gint width,
gint height,
gboolean dot_for_dot,
gint *popup_width,
gint *popup_height);
static gboolean gimp_brush_pipe_get_popup_size (GimpViewable *viewable,
gint width,
gint height,
gboolean dot_for_dot,
gint *popup_width,
gint *popup_height);
static GimpBrush * gimp_brush_pipe_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static gboolean gimp_brush_pipe_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static GimpBrush * gimp_brush_pipe_select_brush (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static gboolean gimp_brush_pipe_want_null_motion (GimpBrush *brush,
GimpCoords *last_coords,
GimpCoords *cur_coords);
static GimpBrushClass *parent_class = NULL;
......@@ -101,7 +102,7 @@ gimp_brush_pipe_get_type (void)
};
brush_type = g_type_register_static (GIMP_TYPE_BRUSH,
"GimpBrushPipe",
"GimpBrushPipe",
&brush_info, 0);
}
......@@ -196,7 +197,8 @@ gimp_brush_pipe_finalize (GObject *object)
}
static gsize
gimp_brush_pipe_get_memsize (GimpObject *object)
gimp_brush_pipe_get_memsize (GimpObject *object,
gsize *gui_size)
{
GimpBrushPipe *pipe;
gsize memsize = 0;
......@@ -209,11 +211,11 @@ gimp_brush_pipe_get_memsize (GimpObject *object)
sizeof (PipeSelectModes));
for (i = 0; i < pipe->nbrushes; i++)
{
memsize += gimp_object_get_memsize (GIMP_OBJECT (pipe->brushes[i]));
}
memsize += gimp_object_get_memsize (GIMP_OBJECT (pipe->brushes[i]),
gui_size);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
}
static gboolean
......@@ -358,7 +360,7 @@ gimp_brush_pipe_load (const gchar *filename,
buffer = g_string_new (NULL);
while (read (fd, &c, 1) == 1 && c != '\n' && buffer->len < 1024)
g_string_append_c (buffer, c);
if (buffer->len > 0 && buffer->len < 1024)
{
pipe = GIMP_BRUSH_PIPE (g_object_new (GIMP_TYPE_BRUSH_PIPE, NULL));
......@@ -369,7 +371,7 @@ gimp_brush_pipe_load (const gchar *filename,
}
else
{
g_message (_("Invalid UTF-8 string in brush file '%s'."),
g_message (_("Invalid UTF-8 string in brush file '%s'."),
filename);
gimp_object_set_name (GIMP_OBJECT (pipe), _("Unnamed"));
}
......@@ -496,7 +498,7 @@ gimp_brush_pipe_load (const gchar *filename,
g_object_unref (pipe);
return NULL;
}
pipe->nbrushes++;
}
......
......@@ -38,7 +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 gsize gimp_buffer_get_memsize (GimpObject *object,
gsize *gui_size);
static void gimp_buffer_get_preview_size (GimpViewable *viewable,
gint size,
......@@ -136,7 +137,8 @@ gimp_buffer_finalize (GObject *object)
}
static gsize
gimp_buffer_get_memsize (GimpObject *object)
gimp_buffer_get_memsize (GimpObject *object,
gsize *gui_size)
{
GimpBuffer *buffer;
gsize memsize = 0;
......@@ -146,7 +148,8 @@ gimp_buffer_get_memsize (GimpObject *object)
if (buffer->tiles)
memsize += tile_manager_get_memsize (buffer->tiles);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
}
static void
......
......@@ -55,7 +55,8 @@ static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_finalize (GObject *object);
static gsize gimp_channel_get_memsize (GimpObject *object);
static gsize gimp_channel_get_memsize (GimpObject *object,
gsize *gui_size);
static GimpItem * gimp_channel_duplicate (GimpItem *item,
GType new_type,
......@@ -205,17 +206,17 @@ gimp_channel_finalize (GObject *object)
}
static gsize
gimp_channel_get_memsize (GimpObject *object)
gimp_channel_get_memsize (GimpObject *object,
gsize *gui_size)
{
GimpChannel *channel;
gsize memsize = 0;
channel = GIMP_CHANNEL (object);
memsize += channel->num_segs_in * sizeof (BoundSeg);
memsize += channel->num_segs_out * sizeof (BoundSeg);
*gui_size += channel->num_segs_in * sizeof (BoundSeg);
*gui_size += channel->num_segs_out * sizeof (BoundSeg);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
return GIMP_OBJECT_CLASS (parent_class)->get_memsize (object, gui_size);
}
static GimpItem *
......
......@@ -55,7 +55,8 @@ static void gimp_channel_init (GimpChannel *channel);
static void gimp_channel_finalize (GObject *object);
static gsize gimp_channel_get_memsize (GimpObject *object);
static gsize gimp_channel_get_memsize (GimpObject *object,
gsize *gui_size);
static GimpItem * gimp_channel_duplicate (GimpItem *item,
GType new_type,
......@@ -205,17 +206,17 @@ gimp_channel_finalize (GObject *object)
}
static gsize
gimp_channel_get_memsize (GimpObject *object)
gimp_channel_get_memsize (GimpObject *object,
gsize *gui_size)
{
GimpChannel *channel;
gsize memsize = 0;
channel = GIMP_CHANNEL (object);
memsize += channel->num_segs_in * sizeof (BoundSeg);
memsize += channel->num_segs_out * sizeof (BoundSeg);
*gui_size += channel->num_segs_in * sizeof (BoundSeg);
*gui_size += channel->num_segs_out * sizeof (BoundSeg);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
return GIMP_OBJECT_CLASS (parent_class)->get_memsize (object, gui_size);
}
static GimpItem *
......
......@@ -98,7 +98,8 @@ static void gimp_container_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static gsize gimp_container_get_memsize (GimpObject *object);
static gsize gimp_container_get_memsize (GimpObject *object,
gsize *gui_size);
static gboolean gimp_container_serialize (GObject *object,
GimpConfigWriter *writer,
......@@ -360,7 +361,8 @@ gimp_container_get_property (GObject *object,
}
static gsize
gimp_container_get_memsize (GimpObject *object)
gimp_container_get_memsize (GimpObject *object,
gsize *gui_size)
{
GimpContainer *container;
GList *list;
......@@ -379,7 +381,8 @@ gimp_container_get_memsize (GimpObject *object)
strlen (handler->signame));
}
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
}
typedef struct
......
......@@ -56,7 +56,7 @@
#include "text/gimpfont.h"
#include "gimp-intl.h"
#include "gimp-intl.h"
typedef void (* GimpContextCopyPropFunc) (GimpContext *src,
......@@ -87,7 +87,8 @@ static void gimp_context_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static gsize gimp_context_get_memsize (GimpObject *object);
static gsize gimp_context_get_memsize (GimpObject *object,
gsize *gui_size);
static gboolean gimp_context_serialize (GObject *object,
GimpConfigWriter *writer,
......@@ -340,7 +341,7 @@ gimp_context_get_type (void)
0, /* n_preallocs */
(GInstanceInitFunc) gimp_context_init,
};
static const GInterfaceInfo config_iface_info =
static const GInterfaceInfo config_iface_info =
{
(GInterfaceInitFunc) gimp_context_config_iface_init,
NULL, /* iface_finalize */
......@@ -348,7 +349,7 @@ gimp_context_get_type (void)
};
context_type = g_type_register_static (GIMP_TYPE_OBJECT,
"GimpContext",
"GimpContext",
&context_info, 0);
g_type_add_interface_static (context_type,
......@@ -1073,7 +1074,8 @@ gimp_context_get_property (GObject *object,
}
static gsize
gimp_context_get_memsize (GimpObject *object)
gimp_context_get_memsize (GimpObject *object,
gsize *gui_size)
{
GimpContext *context;
gsize memsize = 0;
......@@ -1095,7 +1097,8 @@ gimp_context_get_memsize (GimpObject *object)
if (context->font_name)
memsize += strlen (context->font_name) + 1;
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object);
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
gui_size);
}