[gegl/soc-2013-opecl-ops] buffer: inherit tile size from backend or source
- From: Carlos Zubieta <czubieta src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl/soc-2013-opecl-ops] buffer: inherit tile size from backend or source
- Date: Sat, 14 Sep 2013 23:17:35 +0000 (UTC)
commit 2b547b974e000186396d3415e221f50334a03ae9
Author: Daniel Sabo <DanielSabo gmail com>
Date: Wed Sep 11 21:43:53 2013 -0700
buffer: inherit tile size from backend or source
gegl/buffer/gegl-buffer.c | 20 ++++++++++++++++++--
gegl/buffer/gegl-tile-backend.c | 11 +++++++++++
gegl/buffer/gegl-tile-backend.h | 16 ++++++++++++++++
3 files changed, 45 insertions(+), 2 deletions(-)
---
diff --git a/gegl/buffer/gegl-buffer.c b/gegl/buffer/gegl-buffer.c
index 47af575..07476d7 100644
--- a/gegl/buffer/gegl-buffer.c
+++ b/gegl/buffer/gegl-buffer.c
@@ -569,16 +569,29 @@ gegl_buffer_constructor (GType type,
if (source)
{
if (GEGL_IS_TILE_STORAGE (source))
- buffer->format = GEGL_TILE_STORAGE (source)->format;
+ {
+ GeglTileStorage *src_storage = GEGL_TILE_STORAGE (source);
+ buffer->format = src_storage->format;
+ buffer->tile_width = src_storage->tile_width;
+ buffer->tile_height = src_storage->tile_height;
+ }
else if (GEGL_IS_BUFFER (source))
- buffer->format = GEGL_BUFFER (source)->format;
+ {
+ GeglBuffer *src_buffer = GEGL_BUFFER (source);
+ buffer->format = src_buffer->format;
+ buffer->tile_width = src_buffer->tile_width;
+ buffer->tile_height = src_buffer->tile_height;
+ }
}
else
{
if (buffer->backend)
{
backend = buffer->backend;
+
buffer->format = gegl_tile_backend_get_format (backend);
+ buffer->tile_width = gegl_tile_backend_get_tile_width (backend);
+ buffer->tile_height = gegl_tile_backend_get_tile_height (backend);
}
else
{
@@ -768,6 +781,9 @@ gegl_buffer_constructor (GType type,
*/
buffer->soft_format = buffer->format;
+ g_assert (buffer->tile_width == buffer->tile_storage->tile_width);
+ g_assert (buffer->tile_height == buffer->tile_storage->tile_height);
+
return object;
}
diff --git a/gegl/buffer/gegl-tile-backend.c b/gegl/buffer/gegl-tile-backend.c
index 9b1054d..aa49fcd 100644
--- a/gegl/buffer/gegl-tile-backend.c
+++ b/gegl/buffer/gegl-tile-backend.c
@@ -183,6 +183,17 @@ gegl_tile_backend_get_tile_size (GeglTileBackend *tile_backend)
return tile_backend->priv->tile_size;
}
+gint
+gegl_tile_backend_get_tile_width (GeglTileBackend *tile_backend)
+{
+ return tile_backend->priv->tile_width;
+}
+
+gint
+gegl_tile_backend_get_tile_height (GeglTileBackend *tile_backend)
+{
+ return tile_backend->priv->tile_height;
+}
const Babl *
gegl_tile_backend_get_format (GeglTileBackend *tile_backend)
diff --git a/gegl/buffer/gegl-tile-backend.h b/gegl/buffer/gegl-tile-backend.h
index 9ccfa28..537e667 100644
--- a/gegl/buffer/gegl-tile-backend.h
+++ b/gegl/buffer/gegl-tile-backend.h
@@ -59,6 +59,22 @@ struct _GeglTileBackendClass
gint gegl_tile_backend_get_tile_size (GeglTileBackend *tile_backend);
/**
+ * gegl_tile_backend_get_tile_width:
+ * @tile_backend: a #GeglTileBackend
+ *
+ * Return value: the width of tile from this backend
+ */
+gint gegl_tile_backend_get_tile_width (GeglTileBackend *tile_backend);
+
+/**
+ * gegl_tile_backend_get_tile_height:
+ * @tile_backend: a #GeglTileBackend
+ *
+ * Return value: the height of tile from this backend
+ */
+gint gegl_tile_backend_get_tile_height (GeglTileBackend *tile_backend);
+
+/**
* gegl_tile_backend_get_format: (skip)
* @tile_backend: a #GeglTileBackend
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]