Commit 65490fa1 authored by Daniel Sabo's avatar Daniel Sabo

Fix some issues with creating a buffer from an existing file

Buffers will now correctly inherit the files properties, a value
still needs to be passed in for "format" so there is a default
if the file does not exist.
parent fadfb3b7
......@@ -233,7 +233,13 @@ gegl_buffer_open (const gchar *path)
{
sanity();
return g_object_new (GEGL_TYPE_BUFFER, "path", path, NULL);
return g_object_new (GEGL_TYPE_BUFFER,
/* FIXME: Currently the buffer must always have a format specified,
this format will be used if the path did not point to an
existing file. */
"format", babl_format ("RGBA float"),
"path", path,
NULL);
}
GeglBuffer *
......
......@@ -559,6 +559,14 @@ gegl_buffer_constructor (GType type,
"format", buffer->format,
"path", buffer->path,
NULL);
/* Re-inherit values in case path pointed to an existing buffer */
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);
if (buffer->extent.width == -1 || buffer->extent.height == -1)
buffer->extent = gegl_tile_backend_get_extent (backend);
}
else
{
......
......@@ -1186,6 +1186,10 @@ gegl_tile_backend_file_constructed (GObject *object)
backend->priv->tile_size = backend->priv->tile_width *
backend->priv->tile_height *
backend->priv->px_size;
backend->priv->extent = (GeglRectangle) {self->header.x,
self->header.y,
self->header.width,
self->header.height};
/* insert each of the entries into the hash table */
gegl_tile_backend_file_load_index (self, TRUE);
......
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