Commit e3f265b0 authored by Øyvind Kolås's avatar Øyvind Kolås

constified BablFormats.

* bin/export.c:
* gegl/buffer/gegl-buffer-allocator.c:
* gegl/buffer/gegl-buffer-allocator.h:
* gegl/buffer/gegl-buffer-private.h:
* gegl/buffer/gegl-buffer.c:
* gegl/buffer/gegl-buffer.h:
* gegl/buffer/gegl-cache.h:
* gegl/gegl-chant.h:
* gegl/gegl-init.c:
* gegl/gegl-plugin.h:
* gegl/gegl-types.h:
* gegl/gegl.h:
* gegl/graph/gegl-node.c:
* gegl/graph/gegl-node.h:
* gegl/operation/gegl-operation.c:
* gegl/operation/gegl-operation.h:
* gegl/process/gegl-processor.c:
* gegl/property-types/Makefile.am:
* gegl/property-types/gegl-paramspecs.c:
* operations/io/png-save.c: 
* operations/io/save-pixbuf.c:
* operations/render/Makefile.am:
* operations/workshop/Makefile.am: constified BablFormats.

svn path=/trunk/; revision=1772
parent 9d71b481
2007-12-29 Øyvind Kolås <pippin@gimp.org>
* bin/export.c:
* gegl/buffer/gegl-buffer-allocator.c:
* gegl/buffer/gegl-buffer-allocator.h:
* gegl/buffer/gegl-buffer-private.h:
* gegl/buffer/gegl-buffer.c:
* gegl/buffer/gegl-buffer.h:
* gegl/buffer/gegl-cache.h:
* gegl/gegl-chant.h:
* gegl/gegl-init.c:
* gegl/gegl-plugin.h:
* gegl/gegl-types.h:
* gegl/gegl.h:
* gegl/graph/gegl-node.c:
* gegl/graph/gegl-node.h:
* gegl/operation/gegl-operation.c:
* gegl/operation/gegl-operation.h:
* gegl/process/gegl-processor.c:
* gegl/property-types/Makefile.am:
* gegl/property-types/gegl-paramspecs.c:
* operations/io/png-save.c:
* operations/io/save-pixbuf.c:
* operations/render/Makefile.am:
* operations/workshop/Makefile.am: constified BablFormats.
2007-12-28 Michael Natterer <mitch@gimp.org>
* gegl/operation/gegl-operation-sink.c (process): remove semicolon
......
......@@ -296,7 +296,7 @@ gegl_buffer_export_png (GeglBuffer *gegl_buffer,
strcpy (format_string, "R'G'B'A ");
{
Babl *babl = gegl_buffer->format;
const Babl *babl = gegl_buffer->format;
BablType **type = babl->format.type;
for (i=0; i<babl->format.components; i++)
......
......@@ -117,11 +117,11 @@ gegl_buffer_alloc (GeglBufferAllocator *allocator,
static GHashTable *allocators = NULL;
GeglBuffer *
gegl_buffer_new_from_format (void *babl_format,
gint x,
gint y,
gint width,
gint height)
gegl_buffer_new_from_format (const void *babl_format,
gint x,
gint y,
gint width,
gint height)
{
GeglBufferAllocator *allocator = NULL;
......@@ -149,7 +149,7 @@ gegl_buffer_new_from_format (void *babl_format,
"provider", storage,
NULL);
g_object_unref (storage);
g_hash_table_insert (allocators, babl_format, allocator);
g_hash_table_insert (allocators, (gpointer)babl_format, allocator);
g_free (path);
}
else
......@@ -161,7 +161,7 @@ gegl_buffer_new_from_format (void *babl_format,
"provider", storage,
NULL);
g_object_unref (storage);
g_hash_table_insert (allocators, babl_format, allocator);
g_hash_table_insert (allocators, (gpointer)babl_format, allocator);
}
}
/* check if we already have a GeglBufferAllocator for the needed tile slice */
......
......@@ -51,10 +51,10 @@ GType gegl_buffer_allocator_get_type (void) G_GNUC_CONST;
void gegl_buffer_allocators_free (void);
GeglBuffer *
gegl_buffer_new_from_format (void *babl_format,
gint x,
gint y,
gint width,
gint height);
gegl_buffer_new_from_format (const void *babl_format,
gint x,
gint y,
gint width,
gint height);
#endif
......@@ -40,7 +40,7 @@ struct _GeglBuffer
GeglRectangle extent; /* the dimensions of the buffer */
Babl *format; /* the pixel format used for pixels in this
const Babl *format; /* the pixel format used for pixels in this
buffer */
gint shift_x; /* The relative offset of origins compared with */
......
......@@ -68,7 +68,7 @@ static inline gint needed_width (gint w,
return needed_tiles (w, stride) * stride;
}
static void *int_gegl_buffer_get_format (GeglBuffer *buffer);
static const void *int_gegl_buffer_get_format (GeglBuffer *buffer);
static void
get_property (GObject *gobject,
guint property_id,
......@@ -104,7 +104,7 @@ get_property (GObject *gobject,
if (buffer->format == NULL)
buffer->format = int_gegl_buffer_get_format (buffer);
g_value_set_pointer (value, buffer->format);
g_value_set_pointer (value, (void*)buffer->format); /* Eeeek? */
break;
case PROP_X:
......@@ -631,7 +631,7 @@ gegl_buffer_idle (GeglBuffer *buffer)
/***************************************************************************/
static void *int_gegl_buffer_get_format (GeglBuffer *buffer)
static const void *int_gegl_buffer_get_format (GeglBuffer *buffer)
{
g_assert (buffer);
if (buffer->format != NULL)
......@@ -717,7 +717,7 @@ static inline void
pset (GeglBuffer *buffer,
gint x,
gint y,
Babl *format,
const Babl *format,
guchar *buf)
{
gint tile_width = buffer->storage->tile_width;
......@@ -783,7 +783,7 @@ static inline void
pset (GeglBuffer *buffer,
gint x,
gint y,
Babl *format,
const Babl *format,
gpointer data)
{
guchar *buf = data;
......@@ -866,7 +866,7 @@ static inline void
pget (GeglBuffer *buffer,
gint x,
gint y,
Babl *format,
const Babl *format,
gpointer data)
{
guchar *buf = data;
......@@ -961,7 +961,7 @@ gegl_buffer_iterate (GeglBuffer *buffer,
guchar *buf,
gint rowstride,
gboolean write,
Babl *format,
const Babl *format,
gint level)
{
gint width = buffer->extent.width;
......@@ -1212,7 +1212,7 @@ gegl_buffer_iterate (GeglBuffer *buffer,
void
gegl_buffer_set (GeglBuffer *buffer,
const GeglRectangle *rect,
Babl *format,
const Babl *format,
void *src)
{
GeglBuffer *sub_buf;
......@@ -1254,7 +1254,7 @@ static void gegl_buffer_get_scaled (GeglBuffer *buffer,
const GeglRectangle *rect,
void *dst,
gint rowstride,
void *format,
const void *format,
gint level)
{
GeglBuffer *sub_buf = gegl_buffer_create_sub_buffer (buffer, rect);
......@@ -1562,7 +1562,7 @@ void
gegl_buffer_get (GeglBuffer *buffer,
gdouble scale,
const GeglRectangle *rect,
Babl *format,
const Babl *format,
gpointer dest_buf,
gint rowstride)
{
......@@ -1684,7 +1684,7 @@ gegl_buffer_sample (GeglBuffer *buffer,
gdouble y,
gdouble scale,
gpointer dest,
Babl *format,
const Babl *format,
GeglInterpolation interpolation)
{
/*#define USE_WORKING_SHORTCUT*/
......@@ -1746,7 +1746,7 @@ gegl_buffer_get_extent (GeglBuffer *buffer)
GeglBuffer *
gegl_buffer_new (const GeglRectangle *extent,
Babl *format)
const Babl *format)
{
GeglRectangle empty={0,0,0,0};
......@@ -1790,7 +1790,7 @@ gegl_buffer_copy (GeglBuffer *src,
GeglRectangle src_line;
GeglRectangle dst_line;
gpointer format;
const Babl *format;
guchar *temp;
guint i;
gint pxsize;
......
......@@ -53,7 +53,7 @@ GType gegl_buffer_get_type (void) G_GNUC_CONST;
* buffer and a NULL format makes the buffer default to "RGBA float".
*/
GeglBuffer* gegl_buffer_new (const GeglRectangle *extent,
Babl *format);
const Babl *format);
/**
* gegl_buffer_create_sub_buffer:
......@@ -152,7 +152,7 @@ const GeglRectangle * gegl_buffer_get_extent (GeglBuffer *buffer);
void gegl_buffer_get (GeglBuffer *buffer,
gdouble scale,
const GeglRectangle *rect,
Babl *format,
const Babl *format,
gpointer dest,
gint rowstride);
......@@ -167,7 +167,7 @@ void gegl_buffer_get (GeglBuffer *buffer,
*/
void gegl_buffer_set (GeglBuffer *buffer,
const GeglRectangle *rect,
Babl *format,
const Babl *format,
void *src);
......@@ -228,7 +228,7 @@ void gegl_buffer_sample (GeglBuffer *buffer,
gdouble y,
gdouble scale,
gpointer dest,
Babl *format,
const Babl *format,
GeglInterpolation interpolation);
/**
......
......@@ -39,7 +39,7 @@ struct _GeglCache
{
GeglBuffer parent;
GeglNode *node;
void *format;
const void *format;
GeglRegion *valid_region;
};
......
......@@ -86,6 +86,7 @@ struct Generated
#define gegl_chant_pointer(name, blurb) gpointer name;
#define gegl_chant_color(name, def, blurb) GeglColor *name;
#define gegl_chant_curve(name, blurb) GeglCurve *name;
#define gegl_chant_vector(name, blurb) GeglVector *name;
#include GEGL_CHANT_SELF
......@@ -103,6 +104,7 @@ struct Generated
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_vector
/****************************************************************************/
......@@ -241,6 +243,7 @@ enum
#define gegl_chant_pointer(name, blurb) PROP_##name,
#define gegl_chant_color(name, def, blurb) PROP_##name,
#define gegl_chant_curve(name, blurb) PROP_##name,
#define gegl_chant_vector(name, blurb) PROP_##name,
#include GEGL_CHANT_SELF
......@@ -254,6 +257,7 @@ enum
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_vector
PROP_LAST
};
......@@ -287,6 +291,8 @@ get_property (GObject *gobject,
case PROP_##name: g_value_set_object (value, self->name);break;
#define gegl_chant_curve(name, blurb)\
case PROP_##name: g_value_set_object (value, self->name);break;
#define gegl_chant_vector(name, blurb)\
case PROP_##name: g_value_set_object (value, self->name);break;/*XXX*/
#include GEGL_CHANT_SELF
......@@ -300,6 +306,7 @@ get_property (GObject *gobject,
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_vector
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
break;
......@@ -369,6 +376,15 @@ set_property (GObject *gobject,
g_object_unref (self->name);\
self->name = g_value_dup_object (value);\
break;
#define gegl_chant_vector(name, blurb)\
case PROP_##name:\
if (self->name != NULL && G_IS_OBJECT (self->name))\
{/*XXX: remove old signal */\
g_object_unref (self->name);\
}\
self->name = g_value_dup_object (value);\
g_signal_connect (G_OBJECT (self->name), "changed", G_CALLBACK(gegl_operation_vector_prop_changed), self);\
break; /*XXX*/
#include GEGL_CHANT_SELF
......@@ -382,6 +398,7 @@ set_property (GObject *gobject,
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_vector
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, property_id, pspec);
......@@ -473,6 +490,12 @@ static void gegl_chant_destroy_notify (gpointer data)
g_object_unref (self->name);\
self->name = NULL;\
}
#define gegl_chant_vector(name, blurb)\
if (self->name)\
{\
g_object_unref (self->name);\
self->name = NULL;\
} /*XXX*/
#include GEGL_CHANT_SELF
......@@ -486,6 +509,7 @@ static void gegl_chant_destroy_notify (gpointer data)
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_vector
self = NULL; /* shut up gcc warnings if there were no properties to clean up*/
}
......@@ -649,6 +673,14 @@ gegl_chant_class_init (ChantClass * klass)
G_PARAM_READWRITE |\
G_PARAM_CONSTRUCT |\
GEGL_PAD_INPUT)));
#define gegl_chant_vector(name, blurb) \
g_object_class_install_property (object_class, PROP_##name,\
gegl_param_spec_vector (#name, #name, blurb,\
NULL, \
(GParamFlags) (\
G_PARAM_READWRITE |\
G_PARAM_CONSTRUCT |\
GEGL_PAD_INPUT)));
#include GEGL_CHANT_SELF
#undef gegl_chant_int
......@@ -661,6 +693,7 @@ gegl_chant_class_init (ChantClass * klass)
#undef gegl_chant_pointer
#undef gegl_chant_color
#undef gegl_chant_curve
#undef gegl_chant_vector
}
......
......@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <glib/gstdio.h>
#include "operation/gegl-operation.h"
#include "operation/gegl-extension-handler.h"
static gboolean gegl_post_parse_hook (GOptionContext *context,
......
......@@ -29,6 +29,7 @@
#include <gegl/graph/gegl-visitor.h>
#include <gegl/property-types/gegl-color.h>
#include <gegl/property-types/gegl-curve.h>
#include <gegl/property-types/gegl-vector.h>
#include <gegl/gegl-init.h>
#include <gegl/gegl-utils.h>
#include <gegl/buffer/gegl-buffer.h>
......
......@@ -37,6 +37,7 @@ typedef struct _GeglNode GeglNode;
typedef struct _GeglNodeDynamic GeglNodeDynamic;
typedef struct _GeglOperation GeglOperation;
typedef struct _GeglPad GeglPad;
typedef struct _GeglVector GeglVector;
typedef struct _GeglProcessor GeglProcessor;
typedef struct _GeglPrepareVisitor GeglPrepareVisitor;
typedef struct _GeglVisitable GeglVisitable; /* dummy typedef */
......
......@@ -405,7 +405,7 @@ typedef enum
void gegl_node_blit (GeglNode *node,
gdouble scale,
GeglRectangle *roi,
Babl *format,
const Babl *format,
gpointer destination_buf,
gint rowstride,
GeglBlitFlags flags);
......@@ -882,7 +882,7 @@ void gegl_curve_set_point (GeglCurve *self,
guint gegl_curve_num_points (GeglCurve *self);
gdouble gegl_curve_calc_value (GeglCurve *self,
gdouble gegl_curve_calc_value (GeglCurve *self,
gdouble x);
void gegl_curve_calc_values (GeglCurve *self,
......@@ -892,9 +892,45 @@ void gegl_curve_calc_values (GeglCurve *self,
gdouble *xs,
gdouble *ys);
#ifndef GEGL_INTERNAL
/***
* GeglVector:
*
* Documentation and function signatures left out of documentation until
* API is at least slushy, perhaps even until it is frozen.
*/
typedef struct _GeglVector GeglVector;
GType gegl_vector_get_type (void) G_GNUC_CONST;
#define GEGL_TYPE_VECTOR (gegl_vector_get_type ())
#define GEGL_VECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_VECTOR, GeglVector))
#endif
GeglVector* gegl_vector_new (void);
gdouble gegl_vector_get_length (GeglVector *self);
void gegl_vector_line_to (GeglVector *self,
gdouble x,
gdouble y);
void gegl_vector_calc (GeglVector *self,
gdouble pos,
gdouble *x,
gdouble *y);
void gegl_vector_calc_values (GeglVector *self,
guint num_samples,
gdouble *xs,
gdouble *ys);
G_END_DECLS
/*** this is just here to trick the parser.
/*** this line with it's three starting *** is here to trick the API parser.
*/
#include "gegl/property-types/gegl-paramspecs.h"
#include <babl/babl.h>
......
......@@ -746,7 +746,7 @@ void
gegl_node_blit (GeglNode *node,
gdouble scale,
GeglRectangle *roi,
Babl *format,
const Babl *format,
gpointer destination_buf,
gint rowstride,
GeglBlitFlags flags)
......
......@@ -88,7 +88,7 @@ struct _GeglNodeClass
void gegl_node_blit (GeglNode *node,
gdouble scale,
GeglRectangle *roi,
Babl *format,
const Babl *format,
gpointer destination_buf,
gint rowstride,
GeglBlitFlags flags);
......
......@@ -702,6 +702,18 @@ gegl_operation_get_source (GeglOperation *operation,
return input;
}
void
gegl_operation_vector_prop_changed (GeglVector *vector,
GeglOperation *operation)
{
/* In the end forces a re-render, should be adapted to
* allow a smaller region to be forced for re-rendering
* when the vector is incrementally grown
*/
g_object_notify (G_OBJECT (operation), "vector");
}
void
gegl_operation_gtype_cleanup (void)
{
......
......@@ -251,9 +251,16 @@ gboolean
gegl_operation_calc_source_regions (GeglOperation *operation,
gpointer context_id);
void
gegl_operation_vector_prop_changed (GeglVector *vector,
GeglOperation *operation);
void
gegl_extension_handler_cleanup (void);
void
gegl_operation_gtype_cleanup (void);
G_END_DECLS
#endif /* __GEGL_OPERATION_H__ */
......@@ -517,9 +517,8 @@ gegl_processor_render (GeglProcessor *processor,
gint n_rectangles;
gint i;
g_warning ("hey!");
gegl_region_get_rectangles (processor->queued_region, &rectangles, &n_rectangles);
gegl_region_get_rectangles (processor->queued_region, &rectangles,
&n_rectangles);
for (i = 0; i < n_rectangles && i < 1; i++)
{
......
......@@ -3,12 +3,14 @@ noinst_LTLIBRARIES = libpropertytypes.la
PROPERTYTYPES_sources = \
gegl-color.c \
gegl-curve.c \
gegl-vector.c \
gegl-paramspecs.c
PROPERTYTYPES_headers = \
gegl-color.h \
gegl-curve.h \
gegl-vector.h \
gegl-paramspecs.h
......
......@@ -482,6 +482,7 @@ gegl_param_path_validate (GParamSpec *pspec,
return FALSE;
}
/* rename to not be in conflict with vector based path? */
GParamSpec *
gegl_param_spec_path (const gchar *name,
const gchar *nick,
......
......@@ -95,7 +95,7 @@ gegl_buffer_export_png (GeglBuffer *gegl_buffer,
strcpy (format_string, "R'G'B'A ");
{
Babl *babl= gegl_buffer->format;
const Babl *babl= gegl_buffer->format;
BablType **type = babl->format.type;
for (i=0; i<babl->format.components; i++)
......
......@@ -39,8 +39,8 @@ process (GeglOperation *operation,
if (self->pixbuf)
{
GdkPixbuf **pixbuf = self->pixbuf;
Babl *babl;
BablFormat *format;
const Babl *babl;
const BablFormat *format;
guchar *temp;
GeglRectangle *rect = gegl_operation_source_get_defined_region (operation, "input");
gchar *name;
......
......@@ -10,3 +10,13 @@ text$(SHREXT): text.c $(GEGLHEADERS)
$(PANGO_CFLAGS) $(PANGO_LIBS) \
$(PANGOCAIRO_CFLAGS) $(PANGOCAIRO_LIBS);\
fi
stroke$(SHREXT): stroke.c $(GEGLHEADERS)
@if [ ! -z "$(PANGO_LIBS)" ]; then \
echo $@;\
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDADD) \
$(CAIRO_CFLAGS) $(CAIRO_LIBS) \
$(PANGO_CFLAGS) $(PANGO_LIBS) \
$(PANGOCAIRO_CFLAGS) $(PANGOCAIRO_LIBS);\
fi
......@@ -2,6 +2,7 @@ SUBDIRS = generated
include $(top_srcdir)/operations/Makefile-operations.am
CFLAGS += -I/home/pippin/src/gimp/app -I/home/pippin/src/gimp
line-profile.so: line-profile.c $(GEGLHEADERS)
-$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDADD) $(CAIRO_CFLAGS) $(CAIRO_LIBS)
......
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