Commit 857e1589 authored by Massimo Valentini's avatar Massimo Valentini

nop,buffer-source,transform: set the output format

parent e4a3d4ee
......@@ -60,6 +60,18 @@ static void buffer_changed (GeglBuffer *buffer,
}
static void
gegl_buffer_source_prepare (GeglOperation *operation)
{
const Babl *format = NULL;
GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
if (o->buffer)
format = gegl_buffer_get_format (GEGL_BUFFER (o->buffer));
gegl_operation_set_format (operation, "output", format);
}
static GeglRectangle
get_bounding_box (GeglOperation *operation)
{
......@@ -165,6 +177,7 @@ gegl_chant_class_init (GeglChantClass *klass)
operation_class = GEGL_OPERATION_CLASS (klass);
operation_class->prepare = gegl_buffer_source_prepare;
operation_class->process = process;
operation_class->get_bounding_box = get_bounding_box;
......
......@@ -31,6 +31,13 @@
#include "gegl-chant.h"
static void
gegl_nop_prepare (GeglOperation *self)
{
const Babl *fmt = gegl_operation_get_source_format (self, "input");
gegl_operation_set_format (self, "output", fmt);
}
static gboolean
gegl_nop_process (GeglOperation *operation,
......@@ -65,6 +72,7 @@ gegl_chant_class_init (GeglChantClass *klass)
operation_class = GEGL_OPERATION_CLASS (klass);
operation_class->process = gegl_nop_process;
operation_class->prepare = gegl_nop_prepare;
gegl_operation_class_set_keys (operation_class,
"name", "gegl:nop",
......
......@@ -84,6 +84,8 @@ static GeglNode *gegl_transform_detect (GeglOperation
static gboolean gegl_matrix3_is_affine (GeglMatrix3 *matrix);
static gboolean gegl_transform_matrix3_allow_fast_translate (GeglMatrix3 *matrix);
static void gegl_transform_create_composite_matrix (OpTransform *transform,
GeglMatrix3 *matrix);
/* ************************* */
......@@ -131,6 +133,19 @@ static void
gegl_transform_prepare (GeglOperation *operation)
{
const Babl *format = babl_format ("RaGaBaA float");
GeglMatrix3 matrix;
OpTransform *transform = (OpTransform *) operation;
gegl_transform_create_composite_matrix (transform, &matrix);
if (gegl_transform_matrix3_allow_fast_translate (&matrix))
{
const Babl *fmt = gegl_operation_get_source_format (operation, "input");
if (fmt)
format = fmt;
}
gegl_operation_set_format (operation, "input", format);
gegl_operation_set_format (operation, "output", format);
}
......
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