Commit a6a6ba6f authored by Øyvind "pippin" Kolås's avatar Øyvind "pippin" Kolås
Browse files

buffer: use GeglBufferRectangle inside GeglBuffer

The typedef for GeglRectangle is now:
  typedef struct _GeglBufferRectangle GeglRectangle;
parent 125aa873
......@@ -25,6 +25,7 @@
#include <babl/babl.h>
#include "gegl-buffer.h"
#include "gegl-types.h"
#include "gegl-types-internal.h"
#include "gegl-utils.h"
......@@ -150,14 +151,14 @@ static inline int int_floorf (float x)
static void
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)
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)
{
const uint8_t *src[9];
gint components = bpp / sizeof(uint8_t);
......@@ -323,14 +324,14 @@ gegl_boxfilter_u8_nl (guchar *dest_buf,
}
static void
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)
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)
{
const uint8_t *src[9];
gint components = bpp / sizeof(uint8_t);
......@@ -456,14 +457,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 GeglRectangle *dst_rect,
const GeglRectangle *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 GeglBufferRectangle *dst_rect,
const GeglBufferRectangle *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;
......@@ -584,14 +585,14 @@ gegl_bilinear_u8_nl (guchar *dest_buf,
}
static void
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)
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)
{
const gint ver = s_rowstride;
const gint diag = ver + components;
......@@ -992,14 +993,14 @@ gegl_downscale_2x2_nearest (const Babl *format,
}
static void
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)
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)
{
const Babl *tmp_format = babl_format_with_space ("RGBA float", format);
const Babl *from_fish = babl_fish (format, tmp_format);
......@@ -1044,14 +1045,14 @@ gegl_resample_boxfilter_generic (guchar *dest_buf,
}
}
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 (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)
{
const Babl *model = babl_format_get_model (format);
const Babl *comp_type = babl_format_get_type (format, 0);
......@@ -1099,14 +1100,14 @@ void gegl_resample_boxfilter (guchar *dest_buf,
}
static void
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)
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)
{
const Babl *tmp_format = babl_format_with_space ("RGBA float", format);
const Babl *from_fish = babl_fish (format, tmp_format);
......@@ -1152,14 +1153,14 @@ gegl_resample_bilinear_generic (guchar *dest_buf,
}
}
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 (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)
{
const Babl *model = babl_format_get_model (format);
const Babl *comp_type = babl_format_get_type (format, 0);
......@@ -1209,14 +1210,14 @@ void gegl_resample_bilinear (guchar *dest_buf,
}
void
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)
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)
{
gint jj[dst_rect->width];
gint x, y;
......
......@@ -92,125 +92,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 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);
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);
/* 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 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);
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);
GeglDownscale2x2Fun gegl_downscale_2x2_get_fun (const Babl *format);
......
This diff is collapsed.
......@@ -49,7 +49,7 @@ typedef enum {
} GeglIteratorTileMode;
typedef struct _SubIterState {
GeglRectangle full_rect; /* The entire area we are iterating over */
GeglBufferRectangle full_rect; /* The entire area we are iterating over */
GeglBuffer *buffer;
GeglAccessMode access_mode;
GeglAbyssPolicy abyss_policy;
......@@ -57,7 +57,7 @@ typedef struct _SubIterState {
gint format_bpp;
GeglIteratorTileMode current_tile_mode;
gint row_stride;
GeglRectangle real_roi;
GeglBufferRectangle real_roi;
gint level;
/* Direct data members */
GeglTile *current_tile;
......@@ -70,11 +70,11 @@ typedef struct _SubIterState {
struct _GeglBufferIteratorPriv
{
gint num_buffers;
GeglIteratorState state;
GeglRectangle origin_tile;
gint remaining_rows;
SubIterState sub_iter[GEGL_BUFFER_MAX_ITERATORS];
gint num_buffers;
GeglIteratorState state;
GeglBufferRectangle origin_tile;
gint remaining_rows;
SubIterState sub_iter[GEGL_BUFFER_MAX_ITERATORS];
};
static inline GeglBufferIterator *
......@@ -98,13 +98,13 @@ gegl_buffer_iterator_empty_new (void)
static inline int
_gegl_buffer_iterator_add (GeglBufferIterator *iter,
GeglBuffer *buf,
const GeglRectangle *roi,
gint level,
const Babl *format,
GeglAccessMode access_mode,
GeglAbyssPolicy abyss_policy)
_gegl_buffer_iterator_add (GeglBufferIterator *iter,
GeglBuffer *buf,
const GeglBufferRectangle *roi,
gint level,
const Babl *format,
GeglAccessMode access_mode,
GeglAbyssPolicy abyss_policy)
{
GeglBufferIteratorPriv *priv = iter->priv;
int index;
......@@ -149,13 +149,13 @@ _gegl_buffer_iterator_add (GeglBufferIterator *iter,
}
int
gegl_buffer_iterator_add (GeglBufferIterator *iter,
GeglBuffer *buf,
const GeglRectangle *roi,
gint level,
const Babl *format,
GeglAccessMode access_mode,
GeglAbyssPolicy abyss_policy)
gegl_buffer_iterator_add (GeglBufferIterator *iter,
GeglBuffer *buf,
const GeglBufferRectangle *roi,
gint level,
const Babl *format,
GeglAccessMode access_mode,
GeglAbyssPolicy abyss_policy)
{
return _gegl_buffer_iterator_add (iter, buf, roi, level, format, access_mode,
abyss_policy);
......@@ -163,12 +163,12 @@ abyss_policy);
GeglBufferIterator *
gegl_buffer_iterator_new (GeglBuffer *buf,
const GeglRectangle *roi,
gint level,
const Babl *format,
GeglAccessMode access_mode,
GeglAbyssPolicy abyss_policy)
gegl_buffer_iterator_new (GeglBuffer *buf,
const GeglBufferRectangle *roi,
gint level,
const Babl *format,
GeglAccessMode access_mode,
GeglAbyssPolicy abyss_policy)
{
GeglBufferIterator *iter = _gegl_buffer_iterator_empty_new ();
_gegl_buffer_iterator_add (iter, buf, roi, level, format,
......@@ -238,7 +238,7 @@ retile_subs (GeglBufferIterator *iter,
int y)
{
GeglBufferIteratorPriv *priv = iter->priv;
GeglRectangle real_roi;
GeglBufferRectangle real_roi;
int index;
int shift_x = priv->origin_tile.x;
......@@ -555,7 +555,7 @@ _gegl_buffer_iterator_stop (GeglBufferIterator *iter)
sub->access_mode & GEGL_ACCESS_WRITE &&
! (sub->access_mode & GEGL_ITERATOR_INCOMPATIBLE))
{
GeglRectangle damage_rect;
GeglBufferRectangle damage_rect;
damage_rect.x = sub->full_rect.x + sub->buffer->shift_x;
damage_rect.y = sub->full_rect.y + sub->buffer->shift_y;
......
......@@ -41,9 +41,9 @@ typedef struct _GeglBufferIteratorPriv GeglBufferIteratorPriv;
*/
typedef struct GeglBufferIterator
{
gint length;
gpointer data[GEGL_BUFFER_MAX_ITERATORS];
GeglRectangle roi[GEGL_BUFFER_MAX_ITERATORS];
gint length;
gpointer data[GEGL_BUFFER_MAX_ITERATORS];
GeglBufferRectangle roi[GEGL_BUFFER_MAX_ITERATORS];
/* Private */
GeglBufferIteratorPriv *priv;
} GeglBufferIterator;
......@@ -75,12 +75,12 @@ GeglBufferIterator *gegl_buffer_iterator_empty_new (void);
* Returns: a new buffer iterator that can be used to iterate through the
* buffers pixels.
*/
GeglBufferIterator * gegl_buffer_iterator_new (GeglBuffer *buffer,
const GeglRectangle *roi,
gint level,
const Babl *format,
GeglAccessMode access_mode,
GeglAbyssPolicy abyss_policy) G_DEPRECATED;
GeglBufferIterator * gegl_buffer_iterator_new (GeglBuffer *buffer,
const GeglBufferRectangle *roi,
gint level,
const Babl *format,
GeglAccessMode access_mode,
GeglAbyssPolicy abyss_policy) G_DEPRECATED;
/**
......@@ -102,13 +102,13 @@ GeglBufferIterator * gegl_buffer_iterator_new (GeglBuffer *buffer,
* Returns: an integer handle refering to the indice in the iterator structure
* of the added buffer.
*/
gint gegl_buffer_iterator_add (GeglBufferIterator *iterator,