[gegl] Drop cache if the node's output format has changed
- From: Daniel Sabo <daniels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Drop cache if the node's output format has changed
- Date: Fri, 29 Mar 2013 19:03:12 +0000 (UTC)
commit 9e86368826f3b1207fb104e70d70c6f9dfb0779e
Author: Daniel Sabo <DanielSabo gmail com>
Date: Wed Jan 16 00:57:22 2013 -0800
Drop cache if the node's output format has changed
gegl/graph/gegl-node.c | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index 1a7d507..1b24c88 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -2052,21 +2052,29 @@ gegl_node_computed_event (GeglCache *self,
GeglCache *
gegl_node_get_cache (GeglNode *node)
{
+ GeglPad *pad;
+ const Babl *format = NULL;
g_return_val_if_fail (GEGL_IS_NODE (node), NULL);
- if (!node->cache)
- {
- GeglPad *pad;
- const Babl *format;
+ /* XXX: it should be possible to have cache for other pads than
+ * only "output" pads
+ */
+ pad = gegl_node_get_pad (node, "output");
+ if (!pad)
+ return NULL;
- /* XXX: it should be possible to have cache for other pads than
- * only "output" pads
- */
- pad = gegl_node_get_pad (node, "output");
- if (!pad)
- return NULL;
+ format = gegl_pad_get_format (pad);
- format = gegl_pad_get_format (pad);
+ if (node->cache && format &&
+ node->cache->format != format)
+ {
+ /* FIXME: Also cover output_format = NULL and cache->format != RGBA float */
+ g_object_unref(node->cache);
+ node->cache = NULL;
+ }
+
+ if (!node->cache)
+ {
if (!format)
{
format = babl_format ("RGBA float");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]