GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit 34aa5723 authored by Daniel Sabo's avatar Daniel Sabo

buffer: inherit tile size from backend or source

parent f0408f3f
......@@ -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;
}
......
......@@ -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)
......
......@@ -58,6 +58,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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment