[gegl] Remove redundant "format" property from GeglCache
- From: Daniel Sabo <daniels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Remove redundant "format" property from GeglCache
- Date: Mon, 10 Mar 2014 13:41:05 +0000 (UTC)
commit af0172f43d3772a9ae0c65a629cad005366ec54b
Author: Daniel Sabo <DanielSabo gmail com>
Date: Sun Mar 9 15:18:23 2014 -0700
Remove redundant "format" property from GeglCache
Which mirrored the buffers format, but was not kept in sync.
gegl/buffer/gegl-cache.c | 37 -------------------------------------
gegl/buffer/gegl-cache.h | 1 -
gegl/graph/gegl-node.c | 2 +-
gegl/process/gegl-processor.c | 18 ++++++++++--------
4 files changed, 11 insertions(+), 47 deletions(-)
---
diff --git a/gegl/buffer/gegl-cache.c b/gegl/buffer/gegl-cache.c
index a781ee7..ae7cbe9 100644
--- a/gegl/buffer/gegl-cache.c
+++ b/gegl/buffer/gegl-cache.c
@@ -70,7 +70,6 @@ gegl_cache_constructed (GObject *object)
G_OBJECT_CLASS (gegl_cache_parent_class)->constructed (object);
self->valid_region = gegl_region_new ();
- self->format = gegl_buffer_get_format (GEGL_BUFFER (self));
}
/* expand invalidated regions to be align with coordinates divisible by 8 in both
@@ -172,10 +171,6 @@ static void
gegl_cache_init (GeglCache *self)
{
g_mutex_init (&self->mutex);
-
- /* thus providing a default value for GeglCache, that overrides the NULL
- * from GeglBuffer */
- GEGL_BUFFER (self)->format = (gpointer) babl_format ("R'G'B'A u8");
}
static void
@@ -258,42 +253,10 @@ get_property (GObject *gobject,
}
}
-#if 0
-static void
-gegl_buffer_clear (GeglBuffer *buffer,
- GeglRectangle *rectangle)
-{
- gint pixels = rectangle->width * rectangle->height;
- guchar *buf = g_malloc (pixels * 4);
- gint i;
-
- for (i=0;i<pixels;i++)
- {
- buf[i*4+0]=25;
- buf[i*4+1]=0;
- buf[i*4+2]=25;
- buf[i*4+3]=40;
- }
- gegl_buffer_set (buffer, rectangle, babl_format ("RGBA u8"), buf);
- g_free (buf);
-}
-#endif
-
void
gegl_cache_invalidate (GeglCache *self,
const GeglRectangle *roi)
{
-#if 0
- if (roi)
- {
- gegl_buffer_clear (GEGL_BUFFER (self), roi);
- }
- else
- {
- g_warning ("XXX: full invalidation of GeglCache NYI\n");
- }
-#endif
-
g_mutex_lock (&self->mutex);
if (roi)
diff --git a/gegl/buffer/gegl-cache.h b/gegl/buffer/gegl-cache.h
index 6965fd7..38f1a50 100644
--- a/gegl/buffer/gegl-cache.h
+++ b/gegl/buffer/gegl-cache.h
@@ -37,7 +37,6 @@ struct _GeglCache
{
GeglBuffer parent_instance;
- const void *format;
GeglRegion *valid_region;
GMutex mutex;
};
diff --git a/gegl/graph/gegl-node.c b/gegl/graph/gegl-node.c
index e991034..b1314a5 100644
--- a/gegl/graph/gegl-node.c
+++ b/gegl/graph/gegl-node.c
@@ -1795,7 +1795,7 @@ gegl_node_get_cache (GeglNode *node)
format = babl_format ("RGBA float");
}
- if (node->cache && node->cache->format != format)
+ if (node->cache && gegl_buffer_get_format ((GeglBuffer *)(node->cache)) != format)
{
g_object_unref (node->cache);
node->cache = NULL;
diff --git a/gegl/process/gegl-processor.c b/gegl/process/gegl-processor.c
index 29bdbe2..4024459 100644
--- a/gegl/process/gegl-processor.c
+++ b/gegl/process/gegl-processor.c
@@ -411,10 +411,11 @@ gegl_processor_get_band_size (gint size)
static gboolean
render_rectangle (GeglProcessor *processor)
{
- gboolean buffered;
- const gint max_area = processor->chunk_size;
- GeglCache *cache = NULL;
- gint pxsize;
+ gboolean buffered;
+ const gint max_area = processor->chunk_size;
+ GeglCache *cache = NULL;
+ const Babl *format = NULL;
+ gint pxsize;
/* Retreive the cache if the processor's node is not buffered if it's
* operation is a sink and it doesn't use the full area */
@@ -423,7 +424,8 @@ render_rectangle (GeglProcessor *processor)
if (buffered)
{
cache = gegl_node_get_cache (processor->input);
- g_object_get (cache, "px-size", &pxsize, NULL);
+ format = gegl_buffer_get_format ((GeglBuffer *)cache);
+ pxsize = babl_format_get_bytes_per_pixel (format);
}
if (processor->dirty_rectangles)
@@ -488,13 +490,13 @@ render_rectangle (GeglProcessor *processor)
/* FIXME: Check if the node caches naturaly, if so the buffer_set call isn't needed */
/* do the image calculations using the buffer */
- gegl_node_blit (processor->input, 1.0, dr, cache->format, buf,
+ gegl_node_blit (processor->input, 1.0, dr, format, buf,
GEGL_AUTO_ROWSTRIDE, GEGL_BLIT_DEFAULT);
/* copy the buffer data into the cache */
- gegl_buffer_set (GEGL_BUFFER (cache), dr, 0, cache->format, buf,
- GEGL_AUTO_ROWSTRIDE); /* XXX: deal with the level */
+ gegl_buffer_set (GEGL_BUFFER (cache), dr, 0, format, buf,
+ GEGL_AUTO_ROWSTRIDE);
/* tells the cache that the rectangle (dr) has been computed */
gegl_cache_computed (cache, dr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]