[gimp/soc-2011-warp: 53/56] imagemap: add a gegl-caching property to make the caching in gegl optional, default to false
- From: Michael Murà <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2011-warp: 53/56] imagemap: add a gegl-caching property to make the caching in gegl optional, default to false
- Date: Sat, 23 Jul 2011 20:09:29 +0000 (UTC)
commit 3236a38c9abbde2cad0b7f035043824ec4a3862e
Author: Michael Murà <batolettre gmail com>
Date: Sat Jul 23 13:38:19 2011 +0200
imagemap: add a gegl-caching property to make the caching in gegl optional, default to false
app/core/gimpimagemap.c | 79 +++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 73 insertions(+), 6 deletions(-)
---
diff --git a/app/core/gimpimagemap.c b/app/core/gimpimagemap.c
index 6ac7009..2789922 100644
--- a/app/core/gimpimagemap.c
+++ b/app/core/gimpimagemap.c
@@ -59,6 +59,11 @@ enum
LAST_SIGNAL
};
+enum
+{
+ PROP_0,
+ PROP_GEGL_CACHING
+};
struct _GimpImageMap
{
@@ -83,6 +88,7 @@ struct _GimpImageMap
GeglNode *operation;
GeglNode *output;
GeglProcessor *processor;
+ gboolean gegl_caching;
guint idle_id;
@@ -91,10 +97,19 @@ struct _GimpImageMap
};
-static void gimp_image_map_pickable_iface_init (GimpPickableInterface *iface);
+static void gimp_image_map_pickable_iface_init
+ (GimpPickableInterface *iface);
static void gimp_image_map_dispose (GObject *object);
static void gimp_image_map_finalize (GObject *object);
+static void gimp_image_map_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_image_map_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
static GimpImage * gimp_image_map_get_image (GimpPickable *pickable);
static GimpImageType gimp_image_map_get_image_type (GimpPickable *pickable);
@@ -143,8 +158,17 @@ gimp_image_map_class_init (GimpImageMapClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
- object_class->dispose = gimp_image_map_dispose;
- object_class->finalize = gimp_image_map_finalize;
+ object_class->dispose = gimp_image_map_dispose;
+ object_class->finalize = gimp_image_map_finalize;
+ object_class->set_property = gimp_image_map_set_property;
+ object_class->get_property = gimp_image_map_get_property;
+
+ g_object_class_install_property (object_class, PROP_GEGL_CACHING,
+ g_param_spec_boolean ("gegl-caching",
+ "Use caching while rendering the Gegl graph", NULL,
+ FALSE,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
}
static void
@@ -180,6 +204,8 @@ gimp_image_map_init (GimpImageMap *image_map)
if (image_map->timer)
g_timer_stop (image_map->timer);
+
+ image_map->gegl_caching = FALSE;
}
static void
@@ -244,6 +270,44 @@ gimp_image_map_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static void
+gimp_image_map_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GimpImageMap *image_map = GIMP_IMAGE_MAP (object);
+
+ switch (property_id)
+ {
+ case PROP_GEGL_CACHING:
+ image_map->gegl_caching = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gimp_image_map_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GimpImageMap *image_map = GIMP_IMAGE_MAP (object);
+
+ switch (property_id)
+ {
+ case PROP_GEGL_CACHING:
+ g_value_set_boolean (value, image_map->gegl_caching);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
static GimpImage *
gimp_image_map_get_image (GimpPickable *pickable)
{
@@ -646,9 +710,12 @@ gimp_image_map_create_gegl_graph (GimpImageMap *image_map)
{
image_map->gegl = gegl_node_new ();
- g_object_set (image_map->gegl,
- "dont-cache", TRUE,
- NULL);
+ if (!image_map->gegl_caching)
+ {
+ g_object_set (image_map->gegl,
+ "dont-cache", TRUE,
+ NULL);
+ }
image_map->input =
gegl_node_new_child (image_map->gegl,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]