mirror of https://github.com/GNOME/gimp.git
added gimp_g_type_instance_get_memsize() and
2006-04-15 Michael Natterer <mitch@gimp.org> * app/core/gimp-utils.[ch]: added gimp_g_type_instance_get_memsize() and gimp_g_param_spec_get_memsize(). Changed gimp_g_object_get_memsize() to use gimp_g_type_instance_get_memsize(). Handle more boxed types in gimp_g_value_get_memsize(). * app/core/gimp.c (gimp_get_memsize): add the memsize of some members that are new or were forgotten. * app/pdb/gimpprocedure.c * app/pdb/gimppluginprocedure.c: implement GimpObject::get_memsize().
This commit is contained in:
parent
3fb71be183
commit
0855c2e12b
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2006-04-15 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimp-utils.[ch]: added
|
||||||
|
gimp_g_type_instance_get_memsize() and
|
||||||
|
gimp_g_param_spec_get_memsize().
|
||||||
|
Changed gimp_g_object_get_memsize() to use
|
||||||
|
gimp_g_type_instance_get_memsize().
|
||||||
|
Handle more boxed types in gimp_g_value_get_memsize().
|
||||||
|
|
||||||
|
* app/core/gimp.c (gimp_get_memsize): add the memsize of some
|
||||||
|
members that are new or were forgotten.
|
||||||
|
|
||||||
|
* app/pdb/gimpprocedure.c
|
||||||
|
* app/pdb/gimppluginprocedure.c: implement GimpObject::get_memsize().
|
||||||
|
|
||||||
2006-04-14 Manish Singh <yosh@gimp.org>
|
2006-04-14 Manish Singh <yosh@gimp.org>
|
||||||
|
|
||||||
* app/plug-in/plug-in.h: Some compilers don't handle "'" in #error
|
* app/plug-in/plug-in.h: Some compilers don't handle "'" in #error
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
|
|
||||||
#include "gimp.h"
|
#include "gimp.h"
|
||||||
#include "gimp-utils.h"
|
#include "gimp-utils.h"
|
||||||
|
#include "gimpparamspecs.h"
|
||||||
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -83,20 +84,30 @@ gimp_rectangle_intersect (gint x1,
|
||||||
}
|
}
|
||||||
|
|
||||||
gint64
|
gint64
|
||||||
gimp_g_object_get_memsize (GObject *object)
|
gimp_g_type_instance_get_memsize (GTypeInstance *instance)
|
||||||
{
|
{
|
||||||
GTypeQuery type_query;
|
GTypeQuery type_query;
|
||||||
gint64 memsize = 0;
|
gint64 memsize = 0;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_OBJECT (object), 0);
|
g_return_val_if_fail (instance != NULL, 0);
|
||||||
|
|
||||||
g_type_query (G_TYPE_FROM_INSTANCE (object), &type_query);
|
g_type_query (G_TYPE_FROM_INSTANCE (instance), &type_query);
|
||||||
|
|
||||||
memsize += type_query.instance_size;
|
memsize += type_query.instance_size;
|
||||||
|
|
||||||
return memsize;
|
return memsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gint64
|
||||||
|
gimp_g_object_get_memsize (GObject *object)
|
||||||
|
{
|
||||||
|
gint64 memsize = 0;
|
||||||
|
|
||||||
|
g_return_val_if_fail (G_IS_OBJECT (object), 0);
|
||||||
|
|
||||||
|
return memsize + gimp_g_type_instance_get_memsize ((GTypeInstance *) object);
|
||||||
|
}
|
||||||
|
|
||||||
gint64
|
gint64
|
||||||
gimp_g_hash_table_get_memsize (GHashTable *hash)
|
gimp_g_hash_table_get_memsize (GHashTable *hash)
|
||||||
{
|
{
|
||||||
|
@ -124,7 +135,7 @@ gimp_g_list_get_memsize (GList *list,
|
||||||
gint64
|
gint64
|
||||||
gimp_g_value_get_memsize (GValue *value)
|
gimp_g_value_get_memsize (GValue *value)
|
||||||
{
|
{
|
||||||
gint64 memsize = sizeof (GValue);
|
gint64 memsize = sizeof (GValue);
|
||||||
|
|
||||||
if (G_VALUE_HOLDS_STRING (value))
|
if (G_VALUE_HOLDS_STRING (value))
|
||||||
{
|
{
|
||||||
|
@ -143,6 +154,46 @@ gimp_g_value_get_memsize (GValue *value)
|
||||||
{
|
{
|
||||||
memsize += sizeof (GimpMatrix2);
|
memsize += sizeof (GimpMatrix2);
|
||||||
}
|
}
|
||||||
|
else if (GIMP_VALUE_HOLDS_PARASITE (value))
|
||||||
|
{
|
||||||
|
GimpParasite *parasite = g_value_get_boxed (value);
|
||||||
|
|
||||||
|
if (parasite)
|
||||||
|
memsize += (sizeof (GimpParasite) + parasite->size +
|
||||||
|
parasite->name ? (strlen (parasite->name) + 1) : 0);
|
||||||
|
}
|
||||||
|
else if (GIMP_VALUE_HOLDS_ARRAY (value) ||
|
||||||
|
GIMP_VALUE_HOLDS_INT8_ARRAY (value) ||
|
||||||
|
GIMP_VALUE_HOLDS_INT16_ARRAY (value) ||
|
||||||
|
GIMP_VALUE_HOLDS_INT32_ARRAY (value) ||
|
||||||
|
GIMP_VALUE_HOLDS_FLOAT_ARRAY (value))
|
||||||
|
{
|
||||||
|
GimpArray *array = g_value_get_boxed (value);
|
||||||
|
|
||||||
|
if (array)
|
||||||
|
memsize += (sizeof (GimpArray) +
|
||||||
|
array->static_data ? 0 : array->length);
|
||||||
|
}
|
||||||
|
else if (GIMP_VALUE_HOLDS_STRING_ARRAY (value))
|
||||||
|
{
|
||||||
|
GimpArray *array = g_value_get_boxed (value);
|
||||||
|
|
||||||
|
if (array)
|
||||||
|
{
|
||||||
|
memsize += sizeof (GimpArray);
|
||||||
|
|
||||||
|
if (! array->static_data)
|
||||||
|
{
|
||||||
|
gchar **tmp = (gchar **) array->data;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
memsize += array->length * sizeof (gchar *);
|
||||||
|
|
||||||
|
for (i = 0; i < array->length; i++)
|
||||||
|
memsize += strlen (tmp[i]) + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_printerr ("%s: unhandled boxed value type: %s\n",
|
g_printerr ("%s: unhandled boxed value type: %s\n",
|
||||||
|
@ -158,6 +209,37 @@ gimp_g_value_get_memsize (GValue *value)
|
||||||
return memsize;
|
return memsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gint64
|
||||||
|
gimp_g_param_spec_get_memsize (GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
const gchar *str;
|
||||||
|
gint64 memsize = 0;
|
||||||
|
|
||||||
|
if (! (pspec->flags & G_PARAM_STATIC_NAME))
|
||||||
|
{
|
||||||
|
str = g_param_spec_get_name (pspec);
|
||||||
|
if (str)
|
||||||
|
memsize += strlen (str) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! (pspec->flags & G_PARAM_STATIC_NICK))
|
||||||
|
{
|
||||||
|
str = g_param_spec_get_nick (pspec);
|
||||||
|
if (str)
|
||||||
|
memsize += strlen (str) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! (pspec->flags & G_PARAM_STATIC_BLURB))
|
||||||
|
{
|
||||||
|
str = g_param_spec_get_blurb (pspec);
|
||||||
|
if (str)
|
||||||
|
memsize += strlen (str) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return memsize + gimp_g_type_instance_get_memsize ((GTypeInstance *) pspec);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* basically copied from gtk_get_default_language()
|
* basically copied from gtk_get_default_language()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,51 +20,53 @@
|
||||||
#define __APP_GIMP_UTILS_H__
|
#define __APP_GIMP_UTILS_H__
|
||||||
|
|
||||||
|
|
||||||
gboolean gimp_rectangle_intersect (gint x1,
|
gboolean gimp_rectangle_intersect (gint x1,
|
||||||
gint y1,
|
gint y1,
|
||||||
gint width1,
|
gint width1,
|
||||||
gint height1,
|
gint height1,
|
||||||
gint x2,
|
gint x2,
|
||||||
gint y2,
|
gint y2,
|
||||||
gint width2,
|
gint width2,
|
||||||
gint height2,
|
gint height2,
|
||||||
gint *dest_x,
|
gint *dest_x,
|
||||||
gint *dest_y,
|
gint *dest_y,
|
||||||
gint *dest_width,
|
gint *dest_width,
|
||||||
gint *dest_height);
|
gint *dest_height);
|
||||||
|
|
||||||
gint64 gimp_g_object_get_memsize (GObject *object);
|
gint64 gimp_g_type_instance_get_memsize (GTypeInstance *instance);
|
||||||
gint64 gimp_g_hash_table_get_memsize (GHashTable *hash);
|
gint64 gimp_g_object_get_memsize (GObject *object);
|
||||||
gint64 gimp_g_slist_get_memsize (GSList *slist,
|
gint64 gimp_g_hash_table_get_memsize (GHashTable *hash);
|
||||||
gint64 data_size);
|
gint64 gimp_g_slist_get_memsize (GSList *slist,
|
||||||
gint64 gimp_g_list_get_memsize (GList *list,
|
gint64 data_size);
|
||||||
gint64 data_size);
|
gint64 gimp_g_list_get_memsize (GList *list,
|
||||||
gint64 gimp_g_value_get_memsize (GValue *value);
|
gint64 data_size);
|
||||||
|
gint64 gimp_g_value_get_memsize (GValue *value);
|
||||||
|
gint64 gimp_g_param_spec_get_memsize (GParamSpec *pspec);
|
||||||
|
|
||||||
gchar * gimp_get_default_language (const gchar *category);
|
gchar * gimp_get_default_language (const gchar *category);
|
||||||
GimpUnit gimp_get_default_unit (void);
|
GimpUnit gimp_get_default_unit (void);
|
||||||
|
|
||||||
gboolean gimp_boolean_handled_accum (GSignalInvocationHint *ihint,
|
gboolean gimp_boolean_handled_accum (GSignalInvocationHint *ihint,
|
||||||
GValue *return_accu,
|
GValue *return_accu,
|
||||||
const GValue *handler_return,
|
const GValue *handler_return,
|
||||||
gpointer dummy);
|
gpointer dummy);
|
||||||
|
|
||||||
GParameter * gimp_parameters_append (GType object_type,
|
GParameter * gimp_parameters_append (GType object_type,
|
||||||
GParameter *params,
|
GParameter *params,
|
||||||
gint *n_params,
|
gint *n_params,
|
||||||
...) G_GNUC_NULL_TERMINATED;
|
...) G_GNUC_NULL_TERMINATED;
|
||||||
GParameter * gimp_parameters_append_valist (GType object_type,
|
GParameter * gimp_parameters_append_valist (GType object_type,
|
||||||
GParameter *params,
|
GParameter *params,
|
||||||
gint *n_params,
|
gint *n_params,
|
||||||
va_list args);
|
va_list args);
|
||||||
void gimp_parameters_free (GParameter *params,
|
void gimp_parameters_free (GParameter *params,
|
||||||
gint n_params);
|
gint n_params);
|
||||||
|
|
||||||
void gimp_value_array_truncate (GValueArray *args,
|
void gimp_value_array_truncate (GValueArray *args,
|
||||||
gint n_values);
|
gint n_values);
|
||||||
|
|
||||||
gchar * gimp_get_temp_filename (Gimp *gimp,
|
gchar * gimp_get_temp_filename (Gimp *gimp,
|
||||||
const gchar *extension);
|
const gchar *extension);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __APP_GIMP_UTILS_H__ */
|
#endif /* __APP_GIMP_UTILS_H__ */
|
||||||
|
|
|
@ -459,8 +459,21 @@ gimp_get_memsize (GimpObject *object,
|
||||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->parasites),
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->parasites),
|
||||||
gui_size);
|
gui_size);
|
||||||
|
|
||||||
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->paint_info_list),
|
||||||
|
gui_size);
|
||||||
|
|
||||||
memsize += gimp_g_object_get_memsize (G_OBJECT (gimp->module_db));
|
memsize += gimp_g_object_get_memsize (G_OBJECT (gimp->module_db));
|
||||||
|
|
||||||
|
memsize += gimp_g_slist_get_memsize (gimp->plug_in_menu_branches,
|
||||||
|
0 /* FIXME */);
|
||||||
|
memsize += gimp_g_slist_get_memsize (gimp->plug_in_locale_domains,
|
||||||
|
0 /* FIXME */);
|
||||||
|
memsize += gimp_g_slist_get_memsize (gimp->plug_in_help_domains,
|
||||||
|
0 /* FIXME */);
|
||||||
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->interpreter_db),
|
||||||
|
gui_size);
|
||||||
|
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->environ_table),
|
||||||
|
gui_size);
|
||||||
memsize += gimp_g_list_get_memsize (gimp->plug_in_data_list,
|
memsize += gimp_g_list_get_memsize (gimp->plug_in_data_list,
|
||||||
0 /* FIXME */);
|
0 /* FIXME */);
|
||||||
|
|
||||||
|
|
|
@ -42,19 +42,22 @@
|
||||||
#include "gimp-intl.h"
|
#include "gimp-intl.h"
|
||||||
|
|
||||||
|
|
||||||
static void gimp_plug_in_procedure_finalize (GObject *object);
|
static void gimp_plug_in_procedure_finalize (GObject *object);
|
||||||
|
|
||||||
static GValueArray * gimp_plug_in_procedure_execute (GimpProcedure *procedure,
|
static gint64 gimp_plug_in_procedure_get_memsize (GimpObject *object,
|
||||||
Gimp *gimp,
|
gint64 *gui_size);
|
||||||
GimpContext *context,
|
|
||||||
GimpProgress *progress,
|
static GValueArray * gimp_plug_in_procedure_execute (GimpProcedure *procedure,
|
||||||
GValueArray *args);
|
Gimp *gimp,
|
||||||
static void gimp_plug_in_procedure_execute_async (GimpProcedure *procedure,
|
GimpContext *context,
|
||||||
Gimp *gimp,
|
GimpProgress *progress,
|
||||||
GimpContext *context,
|
GValueArray *args);
|
||||||
GimpProgress *progress,
|
static void gimp_plug_in_procedure_execute_async (GimpProcedure *procedure,
|
||||||
GValueArray *args,
|
Gimp *gimp,
|
||||||
gint32 display_ID);
|
GimpContext *context,
|
||||||
|
GimpProgress *progress,
|
||||||
|
GValueArray *args,
|
||||||
|
gint32 display_ID);
|
||||||
|
|
||||||
const gchar * gimp_plug_in_procedure_real_get_progname (const GimpPlugInProcedure *procedure);
|
const gchar * gimp_plug_in_procedure_real_get_progname (const GimpPlugInProcedure *procedure);
|
||||||
|
|
||||||
|
@ -68,15 +71,18 @@ G_DEFINE_TYPE (GimpPlugInProcedure, gimp_plug_in_procedure,
|
||||||
static void
|
static void
|
||||||
gimp_plug_in_procedure_class_init (GimpPlugInProcedureClass *klass)
|
gimp_plug_in_procedure_class_init (GimpPlugInProcedureClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GimpProcedureClass *proc_class = GIMP_PROCEDURE_CLASS (klass);
|
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||||
|
GimpProcedureClass *proc_class = GIMP_PROCEDURE_CLASS (klass);
|
||||||
|
|
||||||
object_class->finalize = gimp_plug_in_procedure_finalize;
|
object_class->finalize = gimp_plug_in_procedure_finalize;
|
||||||
|
|
||||||
proc_class->execute = gimp_plug_in_procedure_execute;
|
gimp_object_class->get_memsize = gimp_plug_in_procedure_get_memsize;
|
||||||
proc_class->execute_async = gimp_plug_in_procedure_execute_async;
|
|
||||||
|
|
||||||
klass->get_progname = gimp_plug_in_procedure_real_get_progname;
|
proc_class->execute = gimp_plug_in_procedure_execute;
|
||||||
|
proc_class->execute_async = gimp_plug_in_procedure_execute_async;
|
||||||
|
|
||||||
|
klass->get_progname = gimp_plug_in_procedure_real_get_progname;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -120,6 +126,65 @@ gimp_plug_in_procedure_finalize (GObject *object)
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gint64
|
||||||
|
gimp_plug_in_procedure_get_memsize (GimpObject *object,
|
||||||
|
gint64 *gui_size)
|
||||||
|
{
|
||||||
|
GimpPlugInProcedure *proc = GIMP_PLUG_IN_PROCEDURE (object);
|
||||||
|
gint64 memsize = 0;
|
||||||
|
GList *list;
|
||||||
|
GSList *slist;
|
||||||
|
|
||||||
|
if (proc->prog)
|
||||||
|
memsize += strlen (proc->prog) + 1;
|
||||||
|
|
||||||
|
if (proc->menu_label)
|
||||||
|
memsize += strlen (proc->menu_label) + 1;
|
||||||
|
|
||||||
|
for (list = proc->menu_paths; list; list = g_list_next (list))
|
||||||
|
memsize += sizeof (GList) + strlen (list->data) + 1;
|
||||||
|
|
||||||
|
switch (proc->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_STOCK_ID:
|
||||||
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
||||||
|
if (proc->icon_data)
|
||||||
|
memsize += strlen ((gchar *) proc->icon_data) + 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_ICON_TYPE_INLINE_PIXBUF:
|
||||||
|
memsize += proc->icon_data_length;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (proc->extensions)
|
||||||
|
memsize += strlen (proc->extensions) + 1;
|
||||||
|
|
||||||
|
if (proc->prefixes)
|
||||||
|
memsize += strlen (proc->prefixes) + 1;
|
||||||
|
|
||||||
|
if (proc->magics)
|
||||||
|
memsize += strlen (proc->magics) + 1;
|
||||||
|
|
||||||
|
if (proc->mime_type)
|
||||||
|
memsize += strlen (proc->mime_type) + 1;
|
||||||
|
|
||||||
|
if (proc->thumb_loader)
|
||||||
|
memsize += strlen (proc->thumb_loader) + 1;
|
||||||
|
|
||||||
|
for (slist = proc->extensions_list; slist; slist = g_slist_next (slist))
|
||||||
|
memsize += sizeof (GSList) + strlen (slist->data) + 1;
|
||||||
|
|
||||||
|
for (slist = proc->prefixes_list; slist; slist = g_slist_next (slist))
|
||||||
|
memsize += sizeof (GSList) + strlen (slist->data) + 1;
|
||||||
|
|
||||||
|
for (slist = proc->magics_list; slist; slist = g_slist_next (slist))
|
||||||
|
memsize += sizeof (GSList) + strlen (slist->data) + 1;
|
||||||
|
|
||||||
|
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
|
||||||
|
gui_size);
|
||||||
|
}
|
||||||
|
|
||||||
static GValueArray *
|
static GValueArray *
|
||||||
gimp_plug_in_procedure_execute (GimpProcedure *procedure,
|
gimp_plug_in_procedure_execute (GimpProcedure *procedure,
|
||||||
Gimp *gimp,
|
Gimp *gimp,
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "pdb-types.h"
|
#include "pdb-types.h"
|
||||||
|
|
||||||
#include "core/gimp.h"
|
#include "core/gimp.h"
|
||||||
|
#include "core/gimp-utils.h"
|
||||||
#include "core/gimpcontext.h"
|
#include "core/gimpcontext.h"
|
||||||
#include "core/gimpchannel.h"
|
#include "core/gimpchannel.h"
|
||||||
#include "core/gimplayer.h"
|
#include "core/gimplayer.h"
|
||||||
|
@ -45,6 +46,9 @@
|
||||||
|
|
||||||
static void gimp_procedure_finalize (GObject *object);
|
static void gimp_procedure_finalize (GObject *object);
|
||||||
|
|
||||||
|
static gint64 gimp_procedure_get_memsize (GimpObject *object,
|
||||||
|
gint64 *gui_size);
|
||||||
|
|
||||||
static GValueArray * gimp_procedure_real_execute (GimpProcedure *procedure,
|
static GValueArray * gimp_procedure_real_execute (GimpProcedure *procedure,
|
||||||
Gimp *gimp,
|
Gimp *gimp,
|
||||||
GimpContext *context,
|
GimpContext *context,
|
||||||
|
@ -70,12 +74,15 @@ G_DEFINE_TYPE (GimpProcedure, gimp_procedure, GIMP_TYPE_OBJECT);
|
||||||
static void
|
static void
|
||||||
gimp_procedure_class_init (GimpProcedureClass *klass)
|
gimp_procedure_class_init (GimpProcedureClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
object_class->finalize = gimp_procedure_finalize;
|
object_class->finalize = gimp_procedure_finalize;
|
||||||
|
|
||||||
klass->execute = gimp_procedure_real_execute;
|
gimp_object_class->get_memsize = gimp_procedure_get_memsize;
|
||||||
klass->execute_async = gimp_procedure_real_execute_async;
|
|
||||||
|
klass->execute = gimp_procedure_real_execute;
|
||||||
|
klass->execute_async = gimp_procedure_real_execute_async;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -113,6 +120,52 @@ gimp_procedure_finalize (GObject *object)
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gint64
|
||||||
|
gimp_procedure_get_memsize (GimpObject *object,
|
||||||
|
gint64 *gui_size)
|
||||||
|
{
|
||||||
|
GimpProcedure *procedure = GIMP_PROCEDURE (object);
|
||||||
|
gint64 memsize = 0;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
if (! procedure->static_strings)
|
||||||
|
{
|
||||||
|
if (procedure->original_name)
|
||||||
|
memsize += strlen (procedure->original_name) + 1;
|
||||||
|
|
||||||
|
if (procedure->blurb)
|
||||||
|
memsize += strlen (procedure->blurb) + 1;
|
||||||
|
|
||||||
|
if (procedure->help)
|
||||||
|
memsize += strlen (procedure->help) + 1;
|
||||||
|
|
||||||
|
if (procedure->author)
|
||||||
|
memsize += strlen (procedure->author) + 1;
|
||||||
|
|
||||||
|
if (procedure->copyright)
|
||||||
|
memsize += strlen (procedure->copyright) + 1;
|
||||||
|
|
||||||
|
if (procedure->date)
|
||||||
|
memsize += strlen (procedure->date) + 1;
|
||||||
|
|
||||||
|
if (procedure->deprecated)
|
||||||
|
memsize += strlen (procedure->deprecated) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
memsize += procedure->num_args * sizeof (GParamSpec *);
|
||||||
|
|
||||||
|
for (i = 0; i < procedure->num_args; i++)
|
||||||
|
memsize += gimp_g_param_spec_get_memsize (procedure->args[i]);
|
||||||
|
|
||||||
|
memsize += procedure->num_values * sizeof (GParamSpec *);
|
||||||
|
|
||||||
|
for (i = 0; i < procedure->num_values; i++)
|
||||||
|
memsize += gimp_g_param_spec_get_memsize (procedure->values[i]);
|
||||||
|
|
||||||
|
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
|
||||||
|
gui_size);
|
||||||
|
}
|
||||||
|
|
||||||
static GValueArray *
|
static GValueArray *
|
||||||
gimp_procedure_real_execute (GimpProcedure *procedure,
|
gimp_procedure_real_execute (GimpProcedure *procedure,
|
||||||
Gimp *gimp,
|
Gimp *gimp,
|
||||||
|
|
|
@ -42,19 +42,22 @@
|
||||||
#include "gimp-intl.h"
|
#include "gimp-intl.h"
|
||||||
|
|
||||||
|
|
||||||
static void gimp_plug_in_procedure_finalize (GObject *object);
|
static void gimp_plug_in_procedure_finalize (GObject *object);
|
||||||
|
|
||||||
static GValueArray * gimp_plug_in_procedure_execute (GimpProcedure *procedure,
|
static gint64 gimp_plug_in_procedure_get_memsize (GimpObject *object,
|
||||||
Gimp *gimp,
|
gint64 *gui_size);
|
||||||
GimpContext *context,
|
|
||||||
GimpProgress *progress,
|
static GValueArray * gimp_plug_in_procedure_execute (GimpProcedure *procedure,
|
||||||
GValueArray *args);
|
Gimp *gimp,
|
||||||
static void gimp_plug_in_procedure_execute_async (GimpProcedure *procedure,
|
GimpContext *context,
|
||||||
Gimp *gimp,
|
GimpProgress *progress,
|
||||||
GimpContext *context,
|
GValueArray *args);
|
||||||
GimpProgress *progress,
|
static void gimp_plug_in_procedure_execute_async (GimpProcedure *procedure,
|
||||||
GValueArray *args,
|
Gimp *gimp,
|
||||||
gint32 display_ID);
|
GimpContext *context,
|
||||||
|
GimpProgress *progress,
|
||||||
|
GValueArray *args,
|
||||||
|
gint32 display_ID);
|
||||||
|
|
||||||
const gchar * gimp_plug_in_procedure_real_get_progname (const GimpPlugInProcedure *procedure);
|
const gchar * gimp_plug_in_procedure_real_get_progname (const GimpPlugInProcedure *procedure);
|
||||||
|
|
||||||
|
@ -68,15 +71,18 @@ G_DEFINE_TYPE (GimpPlugInProcedure, gimp_plug_in_procedure,
|
||||||
static void
|
static void
|
||||||
gimp_plug_in_procedure_class_init (GimpPlugInProcedureClass *klass)
|
gimp_plug_in_procedure_class_init (GimpPlugInProcedureClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
GimpProcedureClass *proc_class = GIMP_PROCEDURE_CLASS (klass);
|
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||||
|
GimpProcedureClass *proc_class = GIMP_PROCEDURE_CLASS (klass);
|
||||||
|
|
||||||
object_class->finalize = gimp_plug_in_procedure_finalize;
|
object_class->finalize = gimp_plug_in_procedure_finalize;
|
||||||
|
|
||||||
proc_class->execute = gimp_plug_in_procedure_execute;
|
gimp_object_class->get_memsize = gimp_plug_in_procedure_get_memsize;
|
||||||
proc_class->execute_async = gimp_plug_in_procedure_execute_async;
|
|
||||||
|
|
||||||
klass->get_progname = gimp_plug_in_procedure_real_get_progname;
|
proc_class->execute = gimp_plug_in_procedure_execute;
|
||||||
|
proc_class->execute_async = gimp_plug_in_procedure_execute_async;
|
||||||
|
|
||||||
|
klass->get_progname = gimp_plug_in_procedure_real_get_progname;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -120,6 +126,65 @@ gimp_plug_in_procedure_finalize (GObject *object)
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gint64
|
||||||
|
gimp_plug_in_procedure_get_memsize (GimpObject *object,
|
||||||
|
gint64 *gui_size)
|
||||||
|
{
|
||||||
|
GimpPlugInProcedure *proc = GIMP_PLUG_IN_PROCEDURE (object);
|
||||||
|
gint64 memsize = 0;
|
||||||
|
GList *list;
|
||||||
|
GSList *slist;
|
||||||
|
|
||||||
|
if (proc->prog)
|
||||||
|
memsize += strlen (proc->prog) + 1;
|
||||||
|
|
||||||
|
if (proc->menu_label)
|
||||||
|
memsize += strlen (proc->menu_label) + 1;
|
||||||
|
|
||||||
|
for (list = proc->menu_paths; list; list = g_list_next (list))
|
||||||
|
memsize += sizeof (GList) + strlen (list->data) + 1;
|
||||||
|
|
||||||
|
switch (proc->icon_type)
|
||||||
|
{
|
||||||
|
case GIMP_ICON_TYPE_STOCK_ID:
|
||||||
|
case GIMP_ICON_TYPE_IMAGE_FILE:
|
||||||
|
if (proc->icon_data)
|
||||||
|
memsize += strlen ((gchar *) proc->icon_data) + 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GIMP_ICON_TYPE_INLINE_PIXBUF:
|
||||||
|
memsize += proc->icon_data_length;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (proc->extensions)
|
||||||
|
memsize += strlen (proc->extensions) + 1;
|
||||||
|
|
||||||
|
if (proc->prefixes)
|
||||||
|
memsize += strlen (proc->prefixes) + 1;
|
||||||
|
|
||||||
|
if (proc->magics)
|
||||||
|
memsize += strlen (proc->magics) + 1;
|
||||||
|
|
||||||
|
if (proc->mime_type)
|
||||||
|
memsize += strlen (proc->mime_type) + 1;
|
||||||
|
|
||||||
|
if (proc->thumb_loader)
|
||||||
|
memsize += strlen (proc->thumb_loader) + 1;
|
||||||
|
|
||||||
|
for (slist = proc->extensions_list; slist; slist = g_slist_next (slist))
|
||||||
|
memsize += sizeof (GSList) + strlen (slist->data) + 1;
|
||||||
|
|
||||||
|
for (slist = proc->prefixes_list; slist; slist = g_slist_next (slist))
|
||||||
|
memsize += sizeof (GSList) + strlen (slist->data) + 1;
|
||||||
|
|
||||||
|
for (slist = proc->magics_list; slist; slist = g_slist_next (slist))
|
||||||
|
memsize += sizeof (GSList) + strlen (slist->data) + 1;
|
||||||
|
|
||||||
|
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
|
||||||
|
gui_size);
|
||||||
|
}
|
||||||
|
|
||||||
static GValueArray *
|
static GValueArray *
|
||||||
gimp_plug_in_procedure_execute (GimpProcedure *procedure,
|
gimp_plug_in_procedure_execute (GimpProcedure *procedure,
|
||||||
Gimp *gimp,
|
Gimp *gimp,
|
||||||
|
|
Loading…
Reference in New Issue