Commit cc7028d8 authored by Øyvind "pippin" Kolås's avatar Øyvind "pippin" Kolås

buffer: move definitions of GeglRectangle and buffer enums to buffer

This reverts earlier indentation breaking changes when GeglRectangle was
renamed GeglBufferRectangle this change also retains the existing released API
and ABI more exactly.
parent e98f33c3
......@@ -62,9 +62,11 @@ GEGL_introspectable_headers = \
buffer/gegl-buffer-iterator.h \
buffer/gegl-buffer-iterator2.h \
buffer/gegl-buffer-backend.h \
buffer/gegl-rectangle.h \
buffer/gegl-tile-backend.h \
buffer/gegl-tile-handler.h \
buffer/gegl-tile-source.h \
buffer/gegl-buffer-enums.h \
graph/gegl-node.h \
process/gegl-graph-debug.h \
process/gegl-processor.h \
......
......@@ -29,12 +29,15 @@ libbuffer_la_SOURCES = \
gegl-buffer-access.c \
gegl-buffer-config.c \
gegl-buffer-config.h \
gegl-buffer-enums.c \
gegl-buffer-enums.h \
gegl-buffer-matrix2.c \
gegl-buffer-matrix2.h \
gegl-buffer-index.h \
gegl-buffer-iterator.c \
gegl-buffer-iterator2.c \
gegl-buffer-linear.c \
gegl-rectangle.c \
gegl-buffer-load.c \
gegl-buffer-save.c \
gegl-sampler.c \
......@@ -64,6 +67,7 @@ libbuffer_la_SOURCES = \
gegl-buffer-iterator.h \
gegl-buffer-iterator2.h \
gegl-buffer-iterator-private.h \
gegl-rectangle.h \
gegl-buffer-types.h \
gegl-buffer-formats.h \
gegl-sampler.h \
......
void
BILINEAR_FUNCNAME (guchar *dest_buf,
const guchar *source_buf,
BILINEAR_FUNCNAME (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
const gint s_rowstride,
const gdouble scale,
const gint bpp,
const gint d_rowstride)
const gint s_rowstride,
const gdouble scale,
const gint bpp,
const gint d_rowstride)
{
const gint components = bpp / sizeof(BILINEAR_TYPE);
const gint ver = s_rowstride/(bpp/components);
......
void
BOXFILTER_FUNCNAME (guchar *dest_buf,
const guchar *source_buf,
BOXFILTER_FUNCNAME (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
const gint s_rowstride,
const gdouble scale,
const gint bpp,
const gint d_rowstride)
const gint s_rowstride,
const gdouble scale,
const gint bpp,
const gint d_rowstride)
{
const BOXFILTER_TYPE *src[9];
gint components = bpp / sizeof(BOXFILTER_TYPE);
......
......@@ -26,9 +26,7 @@
#include <babl/babl.h>
#include "gegl-buffer.h"
#include "gegl-types.h"
#include "gegl-buffer-formats.h"
#include "gegl-utils.h"
#include "gegl-algorithms.h"
#include <math.h>
......@@ -151,14 +149,14 @@ static inline int int_floorf (float x)
static void
gegl_boxfilter_u8_nl (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
const gint s_rowstride,
const gdouble scale,
const gint bpp,
const gint d_rowstride)
gegl_boxfilter_u8_nl (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
const gint s_rowstride,
const gdouble scale,
const gint bpp,
const gint d_rowstride)
{
const uint8_t *src[9];
gint components = bpp / sizeof(uint8_t);
......@@ -324,14 +322,14 @@ gegl_boxfilter_u8_nl (guchar *dest_buf,
}
static void
gegl_boxfilter_u8_nl_alpha (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
const gint s_rowstride,
const gdouble scale,
const gint bpp,
const gint d_rowstride)
gegl_boxfilter_u8_nl_alpha (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
const gint s_rowstride,
const gdouble scale,
const gint bpp,
const gint d_rowstride)
{
const uint8_t *src[9];
gint components = bpp / sizeof(uint8_t);
......@@ -457,14 +455,14 @@ gegl_boxfilter_u8_nl_alpha (guchar *dest_buf,
#undef C
static void
gegl_bilinear_u8_nl (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
const gint s_rowstride,
const gdouble scale,
const gint components,
const gint d_rowstride)
gegl_bilinear_u8_nl (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
const gint s_rowstride,
const gdouble scale,
const gint components,
const gint d_rowstride)
{
const gint ver = s_rowstride;
const gint diag = ver + components;
......@@ -585,14 +583,14 @@ gegl_bilinear_u8_nl (guchar *dest_buf,
}
static void
gegl_bilinear_u8_nl_alpha (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
const gint s_rowstride,
const gdouble scale,
const gint components,
const gint d_rowstride)
gegl_bilinear_u8_nl_alpha (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
const gint s_rowstride,
const gdouble scale,
const gint components,
const gint d_rowstride)
{
const gint ver = s_rowstride;
const gint diag = ver + components;
......@@ -993,14 +991,14 @@ gegl_downscale_2x2_nearest (const Babl *format,
}
static void
gegl_resample_boxfilter_generic (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride)
gegl_resample_boxfilter_generic (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride)
{
const Babl *tmp_format = babl_format_with_space ("RGBA float", format);
const Babl *from_fish = babl_fish (format, tmp_format);
......@@ -1045,14 +1043,14 @@ gegl_resample_boxfilter_generic (guchar *dest_buf,
}
}
void gegl_resample_boxfilter (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride)
void gegl_resample_boxfilter (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride)
{
const Babl *model = babl_format_get_model (format);
const Babl *comp_type = babl_format_get_type (format, 0);
......@@ -1100,14 +1098,14 @@ void gegl_resample_boxfilter (guchar *dest_buf,
}
static void
gegl_resample_bilinear_generic (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride)
gegl_resample_bilinear_generic (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride)
{
const Babl *tmp_format = babl_format_with_space ("RGBA float", format);
const Babl *from_fish = babl_fish (format, tmp_format);
......@@ -1153,14 +1151,14 @@ gegl_resample_bilinear_generic (guchar *dest_buf,
}
}
void gegl_resample_bilinear (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride)
void gegl_resample_bilinear (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride)
{
const Babl *model = babl_format_get_model (format);
const Babl *comp_type = babl_format_get_type (format, 0);
......@@ -1210,14 +1208,14 @@ void gegl_resample_bilinear (guchar *dest_buf,
}
void
gegl_resample_nearest (guchar *dst,
const guchar *src,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
const gint src_stride,
const gdouble scale,
const gint bpp,
const gint dst_stride)
gegl_resample_nearest (guchar *dst,
const guchar *src,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
const gint src_stride,
const gdouble scale,
const gint bpp,
const gint dst_stride)
{
gint jj[dst_rect->width];
gint x, y;
......
......@@ -19,6 +19,7 @@
#ifndef __GEGL_ALGORITHMS_H__
#define __GEGL_ALGORITHMS_H__
#include "gegl-buffer.h"
G_BEGIN_DECLS
#define GEGL_SCALE_EPSILON 1.e-6
......@@ -92,125 +93,125 @@ void gegl_downscale_2x2_nearest (const Babl *format,
* available for #format fall back to nearest neighbor.
* #scale is assumed to be between 0.5 and +inf.
*/
void gegl_resample_boxfilter (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride);
void gegl_resample_boxfilter_double (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_boxfilter_float (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_boxfilter_u32 (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_boxfilter_u16 (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_boxfilter_u8 (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_boxfilter (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride);
void gegl_resample_boxfilter_double (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_boxfilter_float (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_boxfilter_u32 (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_boxfilter_u16 (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_boxfilter_u8 (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
/* Attempt to resample with a 2x2 bilinear filter, if no implementation is
* available for #format fall back to nearest neighbor.
*/
void gegl_resample_bilinear (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride);
void gegl_resample_bilinear_double (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_bilinear_float (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_bilinear_u32 (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_bilinear_u16 (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_bilinear_u8 (guchar *dest_buf,
const guchar *source_buf,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_nearest (guchar *dst,
const guchar *src,
const GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *src_rect,
gint src_stride,
gdouble scale,
gint bpp,
gint dst_stride);
void gegl_resample_bilinear (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
const Babl *format,
gint d_rowstride);
void gegl_resample_bilinear_double (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_bilinear_float (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_bilinear_u32 (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_bilinear_u16 (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_bilinear_u8 (guchar *dest_buf,
const guchar *source_buf,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint s_rowstride,
gdouble scale,
gint bpp,
gint d_rowstride);
void gegl_resample_nearest (guchar *dst,
const guchar *src,
const GeglRectangle *dst_rect,
const GeglRectangle *src_rect,
gint src_stride,
gdouble scale,
gint bpp,
gint dst_stride);
GeglDownscale2x2Fun gegl_downscale_2x2_get_fun (const Babl *format);
......
......@@ -22,13 +22,14 @@
#include "config.h"
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <glib-object.h>
#include <glib/gprintf.h>
#include <gio/gio.h>
#include "gegl.h"
#include <babl/babl.h>
#include "gegl-algorithms.h"
#include "gegl-buffer-types.h"
#include "gegl-buffer.h"
......@@ -37,26 +38,27 @@
#include "gegl-sampler.h"
#include "gegl-tile-backend.h"
#include "gegl-buffer-iterator.h"
#include "gegl-rectangle.h"
#include "gegl-buffer-iterator-private.h"
#include "gegl-buffer-formats.h"
static void gegl_buffer_iterate_read_fringed (GeglBuffer *buffer,
const GeglBufferRectangle *roi,
const GeglBufferRectangle *abyss,
guchar *buf,
gint buf_stride,
const Babl *format,
gint level,
GeglAbyssPolicy repeat_mode);
static void gegl_buffer_iterate_read_fringed (GeglBuffer *buffer,
const GeglRectangle *roi,
const GeglRectangle *abyss,
guchar *buf,
gint buf_stride,
const Babl *format,
gint level,
GeglAbyssPolicy repeat_mode);
static void gegl_buffer_iterate_read_dispatch (GeglBuffer *buffer,
const GeglBufferRectangle *roi,
guchar *buf,
gint rowstride,
const Babl *format,
gint level,
GeglAbyssPolicy repeat_mode);
static void gegl_buffer_iterate_read_dispatch (GeglBuffer *buffer,
const GeglRectangle *roi,
guchar *buf,
gint rowstride,
const Babl *format,
gint level,
GeglAbyssPolicy repeat_mode);
static void inline
gegl_buffer_get_pixel (GeglBuffer *buffer,
......@@ -66,7 +68,7 @@ gegl_buffer_get_pixel (GeglBuffer *buffer,
gpointer data,
GeglAbyssPolicy repeat_mode)
{
const GeglBufferRectangle *abyss = &buffer->abyss;
const GeglRectangle *abyss = &buffer->abyss;
guchar *buf = data;
if (y < abyss->y ||
......@@ -177,8 +179,8 @@ __gegl_buffer_set_pixel (GeglBuffer *buffer,
const Babl *format,
gconstpointer data)
{
const GeglBufferRectangle *abyss = &buffer->abyss;
const guchar *buf = data;
const GeglRectangle *abyss = &buffer->abyss;
const guchar *buf = data;
if (y < abyss->y ||
x < abyss->x ||
......@@ -260,13 +262,13 @@ enum _GeglBufferSetFlag {
typedef enum _GeglBufferSetFlag GeglBufferSetFlag;
void
gegl_buffer_set_with_flags (GeglBuffer *buffer,
const GeglBufferRectangle *rect,
gint level,
const Babl *format,
const void *src,
gint rowstride,
GeglBufferSetFlag set_flags);
gegl_buffer_set_with_flags (GeglBuffer *buffer,
const GeglRectangle *rect,
gint level,
const Babl *format,
const void *src,
gint rowstride,
GeglBufferSetFlag set_flags);
static inline void
......@@ -277,7 +279,7 @@ _gegl_buffer_set_pixel (GeglBuffer *buffer,
gconstpointer data,
GeglBufferSetFlag flags)
{
GeglBufferRectangle rect = {x,y,1,1};
GeglRectangle rect = {x,y,1,1};
switch (flags)
{
case GEGL_BUFFER_SET_FLAG_FAST:
......@@ -327,7 +329,7 @@ gegl_buffer_flush (GeglBuffer *buffer)
}
void
gegl_buffer_flush_ext (GeglBuffer *buffer, const GeglBufferRectangle *rect)
gegl_buffer_flush_ext (GeglBuffer *buffer, const GeglRectangle *rect)
{
if (gegl_buffer_ext_flush)
gegl_buffer_ext_flush (buffer, rect);
......@@ -336,12 +338,12 @@ gegl_buffer_flush_ext (GeglBuffer *buffer, const GeglBufferRectangle *rect)
static inline void
gegl_buffer_iterate_write (GeglBuffer *buffer,
const GeglBufferRectangle *roi,
guchar *buf,