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

Replaced accesor functions with properties for some buffer properties.

* gegl/buffer/Makefile.am: install gegl-buffer.h
* gegl/buffer/gegl-buffer-private.h: added a private header containing
the actual struct of GeglBuffer.
* gegl/buffer/gegl-buffer-allocator.h:
* gegl/buffer/gegl-buffer-save.c: (gegl_buffer_save):
* gegl/buffer/gegl-buffer.c: (get_property),
(gegl_buffer_class_init), (int_gegl_buffer_get_format), (pset),
(pget), (gegl_buffer_iterate):
* gegl/buffer/gegl-buffer.h:
* gegl/buffer/gegl-cache.h:
* gegl/buffer/gegl-interpolator-cubic.c:
* gegl/buffer/gegl-interpolator-lanczos.c:
* gegl/buffer/gegl-interpolator-linear.c:
* gegl/buffer/gegl-interpolator-nearest.c:
* gegl/buffer/gegl-storage.c: (gegl_storage_constructor):
* gegl/buffer/gegl-tile.c:
Fix for changes in buffer API.
* gegl/gegl-processor.c: (gegl_processor_class_init),
(render_rectangle):
* operations/affine/interpolate-cubic.c: (affine_cubic):
* operations/affine/interpolate-lanczos.c: (affine_lanczos):
* operations/affine/linear.c: (affine_linear), (scale_linear):
* operations/affine/nearest.c: (affine_nearest), (scale_nearest):
* operations/color/stretch-contrast.c: (buffer_get_min_max):
* operations/core/crop.c: (process):
* operations/core/save-buffer.c: (process):
* operations/core/shift.c: (process):
* operations/file-io/exr-load.cpp:
* operations/render/FractalExplorer.c: (process):
* operations/render/checkerboard.c: (process):
* operations/render/color.c: (process):
* operations/render/noise.c: (process):
* operations/workshop/Makefile.am:
* operations/workshop/ff-load.c: (process):
* operations/workshop/mandelbrot.c: (process):

svn path=/trunk/; revision=1459
parent 5ee6f6b2
2007-05-10 Øyvind Kolås <pippin@gimp.org>
Replaced accesor functions with properties for some buffer properties.
* gegl/buffer/Makefile.am: install gegl-buffer.h
* gegl/buffer/gegl-buffer-private.h: added a private header containing
the actual struct of GeglBuffer.
* gegl/buffer/gegl-buffer-allocator.h:
* gegl/buffer/gegl-buffer-save.c: (gegl_buffer_save):
* gegl/buffer/gegl-buffer.c: (get_property),
(gegl_buffer_class_init), (int_gegl_buffer_get_format), (pset),
(pget), (gegl_buffer_iterate):
* gegl/buffer/gegl-buffer.h:
* gegl/buffer/gegl-cache.h:
* gegl/buffer/gegl-interpolator-cubic.c:
* gegl/buffer/gegl-interpolator-lanczos.c:
* gegl/buffer/gegl-interpolator-linear.c:
* gegl/buffer/gegl-interpolator-nearest.c:
* gegl/buffer/gegl-storage.c: (gegl_storage_constructor):
* gegl/buffer/gegl-tile.c:
Fix for changes in buffer API.
* gegl/gegl-processor.c: (gegl_processor_class_init),
(render_rectangle):
* operations/affine/interpolate-cubic.c: (affine_cubic):
* operations/affine/interpolate-lanczos.c: (affine_lanczos):
* operations/affine/linear.c: (affine_linear), (scale_linear):
* operations/affine/nearest.c: (affine_nearest), (scale_nearest):
* operations/color/stretch-contrast.c: (buffer_get_min_max):
* operations/core/crop.c: (process):
* operations/core/save-buffer.c: (process):
* operations/core/shift.c: (process):
* operations/file-io/exr-load.cpp:
* operations/render/FractalExplorer.c: (process):
* operations/render/checkerboard.c: (process):
* operations/render/color.c: (process):
* operations/render/noise.c: (process):
* operations/workshop/Makefile.am:
* operations/workshop/ff-load.c: (process):
* operations/workshop/mandelbrot.c: (process):
2007-05-10 Øyvind Kolås <pippin@gimp.org>
Start of work to migrate the creation of output buffers for operations
......
......@@ -52,7 +52,7 @@ BUFFER_headers = \
gegl-tile-zoom.h
libbuffer_la_SOURCES = $(BUFFER_sources) $(BUFFER_headers)
libbufferinclude_HEADERS = #$(BUFFER_headers)
libbufferinclude_HEADERS = gegl-buffer.h
libbufferincludedir = $(includedir)/gegl-$(GEGL_API_VERSION)/gegl/buffer
......
......@@ -33,6 +33,7 @@
#define GEGL_BUFFER_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_BUFFER_ALLOCATOR, GeglBufferAllocatorClass))
#include "gegl-buffer.h"
#include "gegl-buffer-private.h"
struct _GeglBufferAllocator
{
......
/* This file is part of GEGL.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Copyright 2006 Øyvind Kolås <pippin@gimp.org>
*/
#ifndef _GEGL_BUFFER_PRIVATE_H
#define _GEGL_BUFFER_PRIVATE_H
#include <glib.h>
#include <glib-object.h>
#include "gegl-buffer-types.h"
#include <babl/babl.h>
#include "gegl-tile-traits.h"
#define GEGL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_BUFFER, GeglBufferClass))
#define GEGL_IS_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_BUFFER))
#define GEGL_IS_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_BUFFER))
#define GEGL_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_BUFFER, GeglBufferClass))
struct _GeglBuffer
{
GeglTileTraits parent_object;
gpointer format;
gint x; /* the relative position in relation to parent buffer */
gint y; /* the relative position in relation to parent buffer */
gint width;
gint height;
gint shift_x;
gint shift_y;
gint total_shift_x;
gint total_shift_y;
gint abyss_x;
gint abyss_y;
gint abyss_width;
gint abyss_height;
GeglTile *hot_tile;
};
struct _GeglBufferClass
{
GeglTileTraitsClass parent_class;
};
GeglStorage * gegl_buffer_storage (GeglBuffer *buffer);
GeglRectangle gegl_buffer_get_abyss (GeglBuffer *buffer);
gint gegl_buffer_leaks (void);
void gegl_buffer_stats (void);
void gegl_buffer_save (GeglBuffer *buffer,
const gchar *path,
GeglRectangle *roi);
/* flush any unwritten data (flushes the hot-cache of a single
* tile used by gegl_buffer_set for 1x1 pixel sized rectangles
*/
void gegl_buffer_flush (GeglBuffer *buffer);
#endif
......@@ -142,7 +142,9 @@ gegl_buffer_save (GeglBuffer *buffer,
info->header.y = buffer->y;
info->header.tile_width = gegl_buffer_storage (buffer)->tile_width;
info->header.tile_height = gegl_buffer_storage (buffer)->tile_height;
info->header.bpp = gegl_buffer_px_size (buffer);
g_object_get (buffer, "px-size", &(info->header.bpp), NULL);
/* = gegl_buffer_px_size (buffer);*/
info->tile_size = info->header.tile_width * info->header.tile_height * info->header.bpp;
strcpy (info->header.format, ((Babl *) (gegl_buffer_storage (buffer)->format))->instance.name);
......
......@@ -52,7 +52,9 @@ enum
PROP_ABYSS_Y,
PROP_ABYSS_WIDTH,
PROP_ABYSS_HEIGHT,
PROP_FORMAT
PROP_FORMAT,
PROP_PX_SIZE,
PROP_PIXELS
};
......@@ -68,6 +70,7 @@ static inline gint needed_width (gint w,
return needed_tiles (w, stride) * stride;
}
static void *int_gegl_buffer_get_format (GeglBuffer *buffer);
static void
get_property (GObject *gobject,
guint property_id,
......@@ -86,13 +89,22 @@ get_property (GObject *gobject,
g_value_set_int (value, buffer->height);
break;
case PROP_PIXELS:
g_value_set_int (value, buffer->width * buffer->height);
break;
case PROP_PX_SIZE:
g_value_set_int (value, gegl_buffer_storage (buffer)->px_size);
break;
case PROP_FORMAT:
/* might already be set the first time, if it was set during
* construction
* construction, we're caching the value in the buffer itself,
* since it will never change.
*/
if (buffer->format == NULL)
buffer->format = gegl_buffer_get_format (buffer);
buffer->format = int_gegl_buffer_get_format (buffer);
g_value_set_pointer (value, buffer->format);
break;
......@@ -497,6 +509,14 @@ gegl_buffer_class_init (GeglBufferClass *class)
gobject_class->get_property = get_property;
tile_store_class->get_tile = get_tile;
g_object_class_install_property (gobject_class, PROP_PX_SIZE,
g_param_spec_int ("px-size", "pixel-size", "size of a single pixel in bytes.",
0, G_MAXINT, 0,
G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_PIXELS,
g_param_spec_int ("pixels", "pixels", "total amount of pixels in image (width×height)",
0, G_MAXINT, 0,
G_PARAM_READABLE));
g_object_class_install_property (gobject_class, PROP_WIDTH,
g_param_spec_int ("width", "width", "pixel width of buffer",
-1, G_MAXINT, -1,
......@@ -596,7 +616,7 @@ gegl_buffer_idle (GeglBuffer *buffer)
/***************************************************************************/
void *gegl_buffer_get_format (GeglBuffer *buffer)
static void *int_gegl_buffer_get_format (GeglBuffer *buffer)
{
g_assert (buffer);
if (buffer->format != NULL)
......@@ -604,17 +624,6 @@ void *gegl_buffer_get_format (GeglBuffer *buffer)
return gegl_buffer_backend (buffer)->format;
}
gint gegl_buffer_pixels (GeglBuffer *buffer)
{
return buffer->width * buffer->height;
}
gint gegl_buffer_px_size (GeglBuffer *buffer)
{
return gegl_buffer_storage (buffer)->px_size;
}
static void
gegl_buffer_void (GeglBuffer *buffer)
{
......@@ -752,7 +761,6 @@ pset (GeglBuffer *buffer,
guchar *buf = data;
gint tile_width = gegl_buffer_storage (buffer)->tile_width;
gint tile_height = gegl_buffer_storage (buffer)->tile_height;
gint px_size = gegl_buffer_px_size (buffer);
gint bpx_size = FMTPXS (format);
Babl *fish = NULL;
......@@ -762,6 +770,8 @@ pset (GeglBuffer *buffer,
gint buffer_y = buffer->y;
gint buffer_abyss_x = buffer->abyss_x;
gint buffer_abyss_y = buffer->abyss_y;
gint px_size = FMTPXS (buffer->format);
if (format != buffer->format)
{
......@@ -834,7 +844,6 @@ pget (GeglBuffer *buffer,
guchar *buf = data;
gint tile_width = gegl_buffer_storage (buffer)->tile_width;
gint tile_height = gegl_buffer_storage (buffer)->tile_height;
gint px_size = gegl_buffer_px_size (buffer);
gint bpx_size = FMTPXS (format);
Babl *fish = NULL;
......@@ -844,6 +853,7 @@ pget (GeglBuffer *buffer,
gint buffer_y = buffer->y;
gint buffer_abyss_x = buffer->abyss_x;
gint buffer_abyss_y = buffer->abyss_y;
gint px_size = FMTPXS (buffer->format);
if (format != buffer->format)
{
......@@ -927,7 +937,7 @@ gegl_buffer_iterate (GeglBuffer *buffer,
gint height = buffer->height;
gint tile_width = gegl_buffer_storage (buffer)->tile_width;
gint tile_height = gegl_buffer_storage (buffer)->tile_height;
gint px_size = gegl_buffer_px_size (buffer);
gint px_size = FMTPXS (buffer->format);
gint bpx_size = FMTPXS (format);
gint tile_stride = px_size * tile_width;
gint buf_stride;
......
......@@ -26,100 +26,33 @@
#ifndef _GEGL_BUFFER_H
#define _GEGL_BUFFER_H
#define GEGL_TYPE_BUFFER (gegl_buffer_get_type ())
#define GEGL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_BUFFER, GeglBuffer))
#define GEGL_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEGL_TYPE_BUFFER, GeglBufferClass))
#define GEGL_IS_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_BUFFER))
#define GEGL_IS_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_BUFFER))
#define GEGL_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_BUFFER, GeglBufferClass))
#include "gegl-tile-traits.h"
struct _GeglBuffer
{
GeglTileTraits parent_object;
gpointer format;
gint x; /* the relative position in relation to parent buffer */
gint y; /* the relative position in relation to parent buffer */
gint width;
gint height;
gint shift_x;
gint shift_y;
gint total_shift_x;
gint total_shift_y;
gint abyss_x;
gint abyss_y;
gint abyss_width;
gint abyss_height;
GeglTile *hot_tile;
};
#define GEGL_TYPE_BUFFER (gegl_buffer_get_type ())
#define GEGL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_BUFFER, GeglBuffer))
typedef enum {
GEGL_INTERPOLATION_NEAREST
} GeglInterpolation;
struct _GeglBufferClass
{
GeglTileTraitsClass parent_class;
};
GType gegl_buffer_get_type (void) G_GNUC_CONST;
void * gegl_buffer_get_format (GeglBuffer *buffer);
gint gegl_buffer_pixels (GeglBuffer *buffer);
gint gegl_buffer_px_size (GeglBuffer *buffer);
void gegl_buffer_get (GeglBuffer *buffer,
GeglRectangle *rect,
gdouble scale,
void *format,
void *dest);
void gegl_buffer_set (GeglBuffer *buffer,
GeglRectangle *rect,
void *format,
void *src);
void gegl_buffer_sample (GeglBuffer *buffer,
gdouble x,
gdouble y,
gdouble scale,
gpointer dest,
Babl *format,
GeglInterpolation interpolation);
GeglStorage * gegl_buffer_storage (GeglBuffer *buffer);
GeglRectangle gegl_buffer_get_abyss (GeglBuffer *buffer);
gint gegl_buffer_leaks (void);
void gegl_buffer_stats (void);
void gegl_buffer_save (GeglBuffer *buffer,
const gchar *path,
GeglRectangle *roi);
/* flush any unwritten data (flushes the hot-cache of a single
* tile used by gegl_buffer_set for 1x1 pixel sized rectangles
*/
void gegl_buffer_flush (GeglBuffer *buffer);
/* the following are remnants of how horizon used the precursor of the
* tile manager for it's purposes. For now it is not used
gboolean gegl_buffer_idle (GeglBuffer *gegl_buffer);
GType gegl_buffer_get_type (void) G_GNUC_CONST;
void gegl_buffer_add_dirty (GeglBuffer *gegl_buffer,
gint x,
gint y);
void gegl_buffer_get (GeglBuffer *buffer,
GeglRectangle *rect,
gdouble scale,
void *format,
void *dest);
void gegl_buffer_flush_dirty(GeglBuffer *buffer);
void gegl_buffer_set (GeglBuffer *buffer,
GeglRectangle *rect,
void *format,
void *src);
gboolean gegl_buffer_is_dirty (GeglBuffer *buffer,
gint x,
gint y);
*/
void gegl_buffer_sample (GeglBuffer *buffer,
gdouble x,
gdouble y,
gdouble scale,
gpointer dest,
Babl *format,
GeglInterpolation interpolation);
#endif
......@@ -34,6 +34,8 @@ G_BEGIN_DECLS
#define GEGL_IS_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEGL_TYPE_CACHE))
#define GEGL_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEGL_TYPE_CACHE, GeglCacheClass))
#include "gegl-buffer-private.h"
struct _GeglCache
{
GeglBuffer parent;
......
......@@ -17,6 +17,7 @@
*
*/
#include "gegl-interpolator-cubic.h"
#include "gegl-buffer-private.h" /* XXX */
#include <string.h>
#include <math.h>
......
......@@ -17,6 +17,7 @@
*
*/
#include "gegl-interpolator-lanczos.h"
#include "gegl-buffer-private.h" /* XXX */
#include <string.h>
#include <math.h>
......
......@@ -17,6 +17,7 @@
*
*/
#include "gegl-interpolator-linear.h"
#include "gegl-buffer-private.h"
#include <string.h>
enum
{
......
......@@ -17,6 +17,7 @@
*
*/
#include "gegl-interpolator-nearest.h"
#include "gegl-buffer-private.h"
#include <string.h>
enum
{
......
......@@ -248,9 +248,9 @@ gegl_storage_constructor (GType type,
"backend", trait->source,
NULL));
if (0) gegl_tile_traits_add (traits, g_object_new (GEGL_TYPE_TILE_CACHE,
"size", 128,
NULL));
/* it doesn't really matter that empty tiles are not cached, since they
* are Copy on Write.
*/
storage->idle_swapper = g_timeout_add_full (G_PRIORITY_LOW,
250,
......
......@@ -23,6 +23,7 @@
#include "string.h" /* memcpy */
#include "../gegl-types.h"
#include "gegl-buffer.h"
#include "gegl-buffer-private.h"
#include "gegl-tile.h"
G_DEFINE_TYPE (GeglTile, gegl_tile, G_TYPE_OBJECT)
......@@ -413,10 +414,11 @@ gegl_tile_indice (gint coordinate,
/* computes the positive integer remainder (also for negative dividends)
*/
#define REMAINDER(dividend, divisor) \
((((dividend) < 0) ? \
((divisor) - ((-(dividend)) % (divisor))) % (divisor) : \
((dividend) % (divisor))))
#define REMAINDER(dividend, divisor) \
(((dividend) < 0) ? \
(divisor) - 1 - ((-((dividend) + 1)) % (divisor)) : \
(dividend) % (divisor))
/* compute the offset into the containing tile a coordinate has,
* the stride is the width/height of tiles along the axis of coordinate
......
......@@ -93,7 +93,7 @@ static void gegl_processor_class_init (GeglProcessorClass *klass)
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class, PROP_CHUNK_SIZE,
g_param_spec_int ("chunksize", "chunksize", "Size of chunks being rendered (larger chunks need more memory to do the processing).",
8 * 8, 2048 * 2048, 256*256,
8 * 8, 2048 * 2048, 512*512,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
}
......@@ -288,6 +288,8 @@ static gboolean render_rectangle (GeglProcessor *processor)
if (processor->dirty_rectangles)
{
guchar *buf;
gint pxsize;
g_object_get (cache, "px-size", &pxsize, NULL);
dr = processor->dirty_rectangles->data;
......@@ -336,7 +338,7 @@ static gboolean render_rectangle (GeglProcessor *processor)
if (!dr->width || !dr->height)
return TRUE;
buf = g_malloc (dr->width * dr->height * gegl_buffer_px_size (GEGL_BUFFER (cache)));
buf = g_malloc (dr->width * dr->height * pxsize);
g_assert (buf);
gegl_node_blit (cache->node, dr, 1.0, cache->format, 0, (gpointer *) buf, GEGL_BLIT_DEFAULT);
......
......@@ -82,12 +82,17 @@ affine_cubic (GeglBuffer *dest,
gdouble data[64];
gdouble du, dv, fu, fv;
Matrix3 inverse;
gint src_pixels;
gint dest_pixels;
if (gegl_buffer_pixels (src) == 0 ||
gegl_buffer_pixels (dest) == 0)
g_object_get (src, "pixels", &src_pixels, NULL);
g_object_get (dest, "pixels", &dest_pixels, NULL);
if (src_pixels == 0 ||
dest_pixels == 0)
return;
src_buf = g_new (gfloat, gegl_buffer_pixels (src) << 2);
dest_buf = g_new (gfloat, gegl_buffer_pixels (dest) << 2);
src_buf = g_new (gfloat, src_pixels << 2);
dest_buf = g_new (gfloat, dest_pixels << 2);
g_assert (src_buf && dest_buf);
gegl_buffer_get (src, NULL, 1.0, babl_format ("RaGaBaA float"), src_buf);
......
......@@ -101,6 +101,12 @@ affine_lanczos (GeglBuffer *dest,
gdouble du, dv, fu, fv;
Matrix3 inverse;
gint src_pixels;
gint dest_pixels;
g_object_get (src, "pixels", &src_pixels, NULL);
g_object_get (dest, "pixels", &dest_pixels, NULL);
/*
* parameter corretions
* 1. lanczos_width we do not settle for less than lanczos(3)
......@@ -112,11 +118,11 @@ affine_lanczos (GeglBuffer *dest,
lanczos_width2 = lanczos_width * 2 + 1;
lanczos_spp = lanczos_width2 * 10000;
if (gegl_buffer_pixels (src) == 0 ||
gegl_buffer_pixels (dest) == 0)
if (src_pixels == 0 ||
dest_pixels == 0)
return;
src_buf = g_new (gfloat, gegl_buffer_pixels (src) << 2);
dest_buf = g_new (gfloat, gegl_buffer_pixels (dest) << 2);
src_buf = g_new (gfloat, src_pixels << 2);
dest_buf = g_new (gfloat, dest_pixels << 2);
g_assert (src_buf && dest_buf);
gegl_buffer_get (src, NULL, 1.0, babl_format ("RaGaBaA float"), src_buf);
......
......@@ -46,11 +46,17 @@ affine_linear (GeglBuffer *dest,
gdouble u_start,
v_start;
if (gegl_buffer_pixels (src) == 0 ||
gegl_buffer_pixels (dest) == 0)
gint src_pixels;
gint dest_pixels;
g_object_get (src, "pixels", &src_pixels, NULL);
g_object_get (dest, "pixels", &dest_pixels, NULL);
if (src_pixels == 0 ||
dest_pixels == 0)
return;
src_buf = g_new (gfloat, gegl_buffer_pixels (src) * 4);
dest_buf = g_new (gfloat, gegl_buffer_pixels (dest) * 4);
src_buf = g_new (gfloat, src_pixels * 4);
dest_buf = g_new (gfloat, dest_pixels * 4);
g_assert (src_buf && dest_buf);
gegl_buffer_get (src, NULL, 1.0, babl_format ("RaGaBaA float"), src_buf);
......@@ -231,11 +237,17 @@ scale_linear (GeglBuffer *dest,
u_float,
v_float;
if (gegl_buffer_pixels (src) == 0 ||
gegl_buffer_pixels (dest) == 0)
gint src_pixels;
gint dest_pixels;
g_object_get (src, "pixels", &src_pixels, NULL);
g_object_get (dest, "pixels", &dest_pixels, NULL);
if (src_pixels == 0 ||
dest_pixels == 0)
return;
src_buf = g_new (gfloat, gegl_buffer_pixels (src) * 4);
dest_buf = g_new (gfloat, gegl_buffer_pixels (dest) * 4);
src_buf = g_new (gfloat, src_pixels * 4);
dest_buf = g_new (gfloat, dest_pixels * 4);
g_assert (src_buf && dest_buf);
gegl_buffer_get (src, NULL, 1.0, babl_format ("RaGaBaA float"), src_buf);
......
......@@ -43,8 +43,14 @@ affine_nearest (GeglBuffer *dest,
u_float,
v_float;
src_buf = g_new (gfloat, gegl_buffer_pixels (src) * 4);
dest_buf = g_new (gfloat, gegl_buffer_pixels (dest) * 4);
gint src_pixels;
gint dest_pixels;
g_object_get (src, "pixels", &src_pixels, NULL);
g_object_get (dest, "pixels", &dest_pixels, NULL);
src_buf = g_new (gfloat, src_pixels * 4);
dest_buf = g_new (gfloat, dest_pixels * 4);
g_assert (src_buf && dest_buf);
gegl_buffer_get (src, NULL, 1.0, babl_format ("RaGaBaA float"), src_buf);
......@@ -130,9 +136,15 @@ scale_nearest (GeglBuffer *dest,
v_start,
u_float,
v_float;
gint src_pixels;
gint dest_pixels;
g_object_get (src, "pixels", &src_pixels, NULL);
g_object_get (dest, "pixels", &dest_pixels, NULL);
src_buf = g_new (gfloat, gegl_buffer_pixels (src) * 4);
dest_buf = g_new (gfloat, gegl_buffer_pixels (dest) * 4);
src_buf = g_new (gfloat, src_pixels * 4);
dest_buf = g_new (gfloat, dest_pixels * 4);
g_assert (src_buf && dest_buf);
gegl_buffer_get (src, NULL, 1.0, babl_format ("RaGaBaA float"), src_buf);
......
......@@ -61,7 +61,7 @@ buffer_get_min_max (GeglBuffer *buffer,
gfloat *buf = g_malloc0 (sizeof (gfloat) * 4 * buffer->width * buffer->height);
gint i;
gegl_buffer_get (buffer, NULL, 1.0, babl_format ("RGBA float"), buf);
for (i=0;i<gegl_buffer_pixels (buffer);i++)
for (i=0;i<buffer->width * buffer->height;i++)
{
gint component;
for (component=0; component<3; component++)
......
......@@ -58,7 +58,6 @@ process (GeglOperation *operation,
g_assert (input);
g_assert (gegl_buffer_get_format (input));
output = g_object_new (GEGL_TYPE_BUFFER,
"source", input,
......
......@@ -58,12 +58,16 @@ process (GeglOperation *operation,
gpointer format;
guchar *temp;
GeglRectangle rect;
gint pxsize;
input = GEGL_BUFFER (gegl_operation_get_data (operation, context_id, "input"));
g_assert (input);
g_object_get (input, "px-size", &pxsize, NULL);
gegl_rectangle_set (&rect, input->x, input->y, input->width, input->height);
temp = g_malloc (gegl_buffer_pixels (input) * gegl_buffer_px_size (input));
temp = g_malloc (input->width * input->height * pxsize);
format = input->format;
gegl_buffer_get (input, &rect, 1.0, format, temp);
......
......@@ -56,7 +56,6 @@ process (GeglOperation *operation,
translate->y = floor (translate->y);
g_assert (input);
g_assert (gegl_buffer_get_format (input));
output = g_object_new (GEGL_TYPE_BUFFER,
"source", input,
......
......@@ -230,9 +230,12 @@ fix_saturation (GeglBuffer *buf,
const gint nc = has_alpha ? 4 : 3;
gfloat *row[3], *tmp;
GeglRectangle rect;
gint pxsize;
g_object_get (buf, "px-size", &pxsize, NULL);
for (y=0; y<3; y++)
row[y] = (gfloat*) g_malloc0 (gegl_buffer_px_size(buf) * buf->width);
row[y] = (gfloat*) g_malloc0 (pxsize * buf->width);
for (y=0; y<2; y++)
{
......@@ -323,9 +326,10 @@ reconstruct_chroma (GeglBuffer *buf,
gfloat *tmp, *pixels;
gint i;
GeglRectangle rect;
gint pxsize;
g_object_get (buf, "px-size", &pxsize, NULL);
pixels = (gfloat*) g_malloc0 (MAX(buf->width, buf->height)*
gegl_buffer_px_size(buf) );
pixels = (gfloat*) g_malloc0 (MAX(buf->width, buf->height)*pxsize);
tmp = (gfloat*) g_malloc0 (MAX(buf->width, buf->height)*2*sizeof(gfloat));
for (i=0; i<buf->height; i+=2)
......@@ -360,8 +364,10 @@ convert_yca_to_rgba (GeglBuffer *buf,
gfloat r,g,b, y, ry, by, *pxl;
gint row, i, dx = has_alpha ? 4 : 3;
GeglRectangle rect;
gint pxsize;
g_object_get (buf, "px-size", &pxsize, NULL);
pixels = (gchar*) g_malloc0 (buf->width * gegl_buffer_px_size(buf));
pixels = (gchar*) g_malloc0 (buf->width * pxsize);
for (row=0; row<buf->height; row++)
{
......@@ -442,9 +448,12 @@ import_exr (GeglBuffer *gegl_buffer,