Commit 58acff07 authored by Øyvind Kolås's avatar Øyvind Kolås

Removed property_name / pad_name parameter from the process method of source,...

Removed property_name / pad_name parameter from the process method of source, filter and composer. Simplified other bits of the code as needed.
parent bd8a8e2b
2006-09-09 Øyvind Kolås <pippin@gimp.org>
Removed property_name / pad_name parameter from the process method of
source, filter and composer. Simplified other bits of the code as
needed.
* gegl/gegl-chant.h:
* gegl/gegl-operation-composer.c: (process):
* gegl/gegl-operation-composer.h:
* gegl/gegl-operation-filter.c: (process):
* gegl/gegl-operation-filter.h:
* gegl/gegl-operation-point-composer.c: (process_inner):
* gegl/gegl-operation-point-filter.c: (process_inner):
* gegl/gegl-operation-source.c: (process):
* gegl/gegl-operation-source.h:
* operations/blur/box-blur.c: (process):
* operations/blur/gaussian-blur.c: (process):
* operations/color/stretch-contrast.c: (process):
* operations/core/buffer.c: (process):
* operations/core/clone.c: (process):
* operations/core/crop.c: (process):
* operations/core/nop.c: (process):
* operations/core/shift.c: (process):
* operations/display/display.c: (process):
* operations/file-io/jpg-load.c: (process):
* operations/file-io/magick-load.c: (process):
* operations/file-io/png-load.c: (process), (get_defined_region):
* operations/file-io/png-save.c: (process):
* operations/file-io/raw-load.c: (process):
* operations/render/blank.c: (process):
* operations/render/checkerboard.c: (process):
* operations/render/noise.c: (process):
* operations/render/text.c: (process):
* operations/transform/affine.c: (process):
2006-09-09 Øyvind Kolås <pippin@gimp.org>
Use the virtual process method of GeglOperationFilter and
......
......@@ -347,8 +347,7 @@ static gboolean process (GeglOperation *operation,
glong samples);
#else
#ifndef GEGL_CHANT_GRAPH
static gboolean process (GeglOperation *operation,
const gchar *output_prop);
static gboolean process (GeglOperation *operation);
#endif
#endif
#endif
......
......@@ -20,6 +20,7 @@
#include "gegl-operation-composer.h"
#include "gegl-utils.h"
#include <string.h>
enum
{
......@@ -172,13 +173,19 @@ process (GeglOperation *operation,
GeglOperationComposerClass *klass = GEGL_OPERATION_COMPOSER_GET_CLASS (operation);
gboolean success = FALSE;
if (strcmp (output_prop, "output"))
{
g_warning ("requested processing of %s pad on a composer", output_prop);
return FALSE;
}
/* A composer with a NULL aux, can still be valid, the
* subclass has to handle it.
*/
if (gegl_operation_composer->input != NULL)
{
gegl_operation_composer->output = NULL;
success = klass->process (operation, output_prop);
success = klass->process (operation);
}
else
{
......
......@@ -50,8 +50,7 @@ typedef struct _GeglOperationComposerClass GeglOperationComposerClass;
struct _GeglOperationComposerClass
{
GeglOperationClass operation_class;
gboolean (*process) (GeglOperation *self,
const gchar *output_pad);
gboolean (*process) (GeglOperation *self);
};
GType gegl_operation_composer_get_type (void) G_GNUC_CONST;
......
......@@ -18,6 +18,7 @@
* Copyright 2006 Øyvind Kolås
*/
#include "gegl-operation-filter.h"
#include <string.h>
enum
{
......@@ -154,10 +155,16 @@ process (GeglOperation *operation,
g_assert (klass->process);
if (strcmp (output_prop, "output"))
{
g_warning ("requested processing of %s pad on a filter", output_prop);
return FALSE;
}
if (gegl_operation_filter->input != NULL)
{
gegl_operation_filter->output = NULL;
success = klass->process (operation, output_prop);
success = klass->process (operation);
g_object_unref (gegl_operation_filter->input);
gegl_operation_filter->input=NULL;
}
......
......@@ -49,8 +49,7 @@ typedef struct _GeglOperationFilterClass GeglOperationFilterClass;
struct _GeglOperationFilterClass
{
GeglOperationClass operation_class;
gboolean (*process) (GeglOperation *self,
const gchar *output_pad);
gboolean (*process) (GeglOperation *self);
};
......
......@@ -20,8 +20,7 @@
#include "gegl-operation-point-composer.h"
#include <string.h>
static gboolean process_inner (GeglOperation *operation,
const gchar *output_pad);
static gboolean process_inner (GeglOperation *operation);
G_DEFINE_TYPE (GeglOperationPointComposer, gegl_operation_point_composer, GEGL_TYPE_OPERATION_COMPOSER)
......@@ -45,8 +44,7 @@ gegl_operation_point_composer_init (GeglOperationPointComposer *self)
}
static gboolean
process_inner (GeglOperation *operation,
const gchar *output_pad)
process_inner (GeglOperation *operation)
{
GeglOperationComposer *composer = GEGL_OPERATION_COMPOSER (operation);
GeglOperationPointComposer *point_composer = GEGL_OPERATION_POINT_COMPOSER (operation);
......@@ -56,9 +54,6 @@ process_inner (GeglOperation *operation,
GeglRect *result = gegl_operation_result_rect (operation);
GeglBuffer *output;
if(strcmp("output", output_pad))
return FALSE;
if (!input && aux)
{
composer->output = g_object_ref (aux);
......
......@@ -20,8 +20,7 @@
#include "gegl-operation-point-filter.h"
#include <string.h>
static gboolean process_inner (GeglOperation *operation,
const gchar *output_pad);
static gboolean process_inner (GeglOperation *operation);
G_DEFINE_TYPE (GeglOperationPointFilter, gegl_operation_point_filter, GEGL_TYPE_OPERATION_FILTER)
......@@ -41,8 +40,7 @@ gegl_operation_point_filter_init (GeglOperationPointFilter *self)
}
static gboolean
process_inner (GeglOperation *operation,
const gchar *output_pad)
process_inner (GeglOperation *operation)
{
GeglOperationFilter *filter = GEGL_OPERATION_FILTER (operation);
GeglOperationPointFilter *point_filter = GEGL_OPERATION_POINT_FILTER (operation);
......@@ -51,9 +49,6 @@ process_inner (GeglOperation *operation,
GeglRect *result = gegl_operation_result_rect (operation);
GeglBuffer *output;
if(strcmp("output", output_pad))
return FALSE;
{
gfloat *buf;
......
......@@ -18,6 +18,7 @@
* Copyright 2006 Øyvind Kolås
*/
#include "gegl-operation-source.h"
#include <string.h>
enum
{
......@@ -128,8 +129,17 @@ process (GeglOperation *operation,
GeglOperationSourceClass *klass = GEGL_OPERATION_SOURCE_GET_CLASS (operation);
gboolean success;
if (strcmp (output_prop, "output"))
{
g_warning ("requested processing of %s pad on a source operation", output_prop);
return FALSE;
}
GEGL_OPERATION_SOURCE (operation)->output = NULL;
success = klass->process (operation, output_prop);
g_assert (klass->process);
success = klass->process (operation);
return success;
}
......
......@@ -48,8 +48,7 @@ typedef struct _GeglOperationSourceClass GeglOperationSourceClass;
struct _GeglOperationSourceClass
{
GeglOperationClass operation_class;
gboolean (*process) (GeglOperation *self,
const gchar *output_pad);
gboolean (*process) (GeglOperation *self);
};
GType gegl_operation_source_get_type (void) G_GNUC_CONST;
......
......@@ -44,8 +44,7 @@ ver_blur (GeglBuffer *src,
#include <stdio.h>
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
......@@ -56,9 +55,6 @@ process (GeglOperation *operation,
GeglBuffer *input = filter->input;
GeglBuffer *output;
if(strcmp("output", output_prop))
return FALSE;
{
GeglRect *result = gegl_operation_result_rect (operation);
GeglBuffer *temp_in;
......
......@@ -56,8 +56,7 @@ find_iir_constants (gfloat radius,
gdouble *b);
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationFilter *filter;
GeglChantOperation *self;
......@@ -68,10 +67,6 @@ process (GeglOperation *operation,
GeglBuffer *input = filter->input;
GeglBuffer *output;
if(strcmp("output", output_prop))
return FALSE;
{
GeglRect *result = gegl_operation_result_rect (operation);
GeglBuffer *temp_in;
......
......@@ -82,8 +82,7 @@ buffer_get_min_max (GeglBuffer *buffer,
}
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationFilter *filter = GEGL_OPERATION_FILTER (operation);
GeglRect *result;
......@@ -93,7 +92,6 @@ process (GeglOperation *operation,
input = filter->input;
result = gegl_operation_get_requested_region (operation);
if (result->w==0 ||
result->h==0)
......
......@@ -45,16 +45,11 @@ dispose (GObject *object)
}
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationSource *op_source = GEGL_OPERATION_SOURCE(operation);
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
if(strcmp("output", output_prop))
return FALSE;
if (self->buffer)
op_source->output = GEGL_BUFFER (g_object_ref (self->buffer));
return TRUE;
......
......@@ -35,8 +35,7 @@ gegl_chant_string (ref, "", "The reference ID used as input.")
/* Actual image processing code
************************************************************************/
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationFilter *filter = GEGL_OPERATION_FILTER(operation);
......
......@@ -44,8 +44,7 @@ int gegl_chant_foo = 0;
/* Actual image processing code
************************************************************************/
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationFilter *filter;
GeglBuffer *input;
......@@ -55,9 +54,6 @@ process (GeglOperation *operation,
filter = GEGL_OPERATION_FILTER(operation);
input = filter->input;
if(strcmp("output", output_prop))
return FALSE;
g_assert (input);
g_assert (gegl_buffer_get_format (input));
......
......@@ -25,20 +25,10 @@
#define GEGL_CHANT_NAME nop
#define GEGL_CHANT_DESCRIPTION "Passthrough operation"
#define GEGL_CHANT_SELF "nop.c"
#define GEGL_CHANT_CLASS_INIT
#include "gegl-chant.h"
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
{
/* not used */
return TRUE;
}
static gboolean
op_process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationFilter *op_filter = GEGL_OPERATION_FILTER (operation);
gboolean success = FALSE;
......@@ -50,9 +40,5 @@ op_process (GeglOperation *operation,
}
return success;
}
static void class_init (GeglOperationClass *klass)
{
klass->process = op_process;
}
#endif
......@@ -40,17 +40,12 @@ int gegl_chant_foo = 0;
/* Actual image processing code
************************************************************************/
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationFilter *filter = GEGL_OPERATION_FILTER(operation);
GeglBuffer *input = filter->input;
GeglChantOperation *translate = (GeglChantOperation*)filter;
if(strcmp("output", output_prop))
return FALSE;
g_assert (input);
g_assert (gegl_buffer_get_format (input));
......
......@@ -78,8 +78,7 @@ init_sdl (void)
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationFilter *op_filter = GEGL_OPERATION_FILTER (operation);
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
......@@ -87,11 +86,6 @@ process (GeglOperation *operation,
GeglRect *need = gegl_operation_get_requested_region (operation);
SDL_Surface **sdl_outwin = NULL; //op_sym (op, "sdl_outwin");
if(strcmp("output", output_prop))
return FALSE;
/*g_warning ("%s", ((Babl*)(input->format))->instance.name);*/
g_assert (op_filter->input);
init_sdl ();
......
......@@ -45,8 +45,7 @@ query_jpg (const gchar *path,
gint *height);
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationSource *op_source = GEGL_OPERATION_SOURCE (operation);
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
......@@ -54,10 +53,6 @@ process (GeglOperation *operation,
gint height;
gint result;
if(strcmp("output", output_prop))
return FALSE;
{
result = query_jpg (self->path, &width, &height);
if (result)
......
......@@ -59,17 +59,11 @@ load_cache (GeglChantOperation *op_magick_load)
}
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationSource *op_source = GEGL_OPERATION_SOURCE(operation);
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
if(strcmp("output", output_prop))
return FALSE;
if (!self->priv)
return FALSE;
op_source->output= GEGL_BUFFER (self->priv);
......
......@@ -46,18 +46,12 @@ gint query_png (const gchar *path,
gint *height);
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
GeglOperationSource *op_source = GEGL_OPERATION_SOURCE(operation);
gint result;
if(strcmp("output", output_prop))
return FALSE;
{
gint width, height;
......@@ -124,7 +118,7 @@ get_defined_region (GeglOperation *operation)
if (!strcmp (self->path, "-"))
{
process (operation, "output");
process (operation);
width = source->output->width;
height = source->output->height;
}
......
......@@ -41,19 +41,13 @@ gegl_buffer_export_png (GeglBuffer *gegl_buffer,
gint height);
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
GeglOperationFilter *op_filter = GEGL_OPERATION_FILTER (operation);
GeglBuffer *input = op_filter->input;
GeglRect *result = gegl_operation_result_rect (operation);
if(strcmp("output", output_prop))
return FALSE;
/*g_warning ("%s", ((Babl*)(input->format))->instance.name);*/
g_assert (input);
gegl_buffer_export_png (input, self->path,
......
......@@ -41,17 +41,11 @@ gegl_chant_string (path, "/tmp/test.raw", "path to file to load")
static void load_buffer (GeglChantOperation *op_raw_load);
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationSource *op_source = GEGL_OPERATION_SOURCE(operation);
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
if(strcmp("output", output_prop))
return FALSE;
g_assert (self->priv);
op_source->output = GEGL_BUFFER (self->priv);
self->priv = NULL;
......
......@@ -30,17 +30,11 @@
#include "gegl-chant.h"
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglRect *need;
GeglOperationSource *op_source = GEGL_OPERATION_SOURCE(operation);
if(strcmp("output", output_prop))
return FALSE;
need = gegl_operation_get_requested_region (operation);
{
......
......@@ -40,18 +40,12 @@ gegl_chant_int (y_offset, -G_MAXINT, G_MAXINT, 0, "")
(dividend) % (divisor))
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglRect *need;
GeglOperationSource *op_source = GEGL_OPERATION_SOURCE(operation);
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
if(strcmp("output", output_prop))
return FALSE;
need = gegl_operation_get_requested_region (operation);
{
GeglRect *result = gegl_operation_result_rect (operation);
......
......@@ -38,17 +38,12 @@ gegl_chant_double (n, 0, 20.0, 6.0, "")
#include "perlin/perlin.h"
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglRect *need;
GeglOperationSource *op_source = GEGL_OPERATION_SOURCE(operation);
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
if(strcmp("output", output_prop))
return FALSE;
need = gegl_operation_get_requested_region (operation);
{
......
......@@ -77,17 +77,13 @@ static void text_layout_text (GeglChantOperation *self,
}
static gboolean
process (GeglOperation *operation,
const gchar *output_prop)
process (GeglOperation *operation)
{
GeglOperationSource *op_source = GEGL_OPERATION_SOURCE(operation);
GeglChantOperation *self = GEGL_CHANT_OPERATION (operation);
gint width;
gint height;
if(strcmp("output", output_prop))
return FALSE;
width = self->width;
height = self->height;
......
......@@ -62,8 +62,7 @@ static void get_source_matrix (OpAffine *affine,
Matrix3 output);
static GeglRect get_defined_region (GeglOperation *op);
static gboolean calc_source_regions (GeglOperation *op);
static gboolean process (GeglOperation *op,
const gchar *output_prop);
static gboolean process (GeglOperation *op);
/* ************************* */
......@@ -439,18 +438,13 @@ calc_source_regions (GeglOperation *op)
}
static gboolean
process (GeglOperation *op,
const gchar *output_pad)
process (GeglOperation *op)
{
GeglOperationFilter *filter = GEGL_OPERATION_FILTER (op);
OpAffine *affine = (OpAffine *) op;
GeglBuffer *output;
GeglRect *result = gegl_operation_result_rect (op);
if (strcmp (output_pad, "output"))
return FALSE;
/* TODO: remove this check when 0-size buffers are supported */
if (result->w == 0 || result->h == 0)
return FALSE;
......
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