[gegl] buffer: use GeglBufferRectangle inside GeglBuffer



commit a6a6ba6ff5c8e75a85e7c3bb8108fd16cd2f6b35
Author: Øyvind Kolås <pippin gimp org>
Date:   Thu Sep 27 18:07:49 2018 +0200

    buffer: use GeglBufferRectangle inside GeglBuffer
    
    The typedef for GeglRectangle is now:
      typedef struct _GeglBufferRectangle GeglRectangle;

 gegl/buffer/gegl-algorithms.c              | 145 ++++-----
 gegl/buffer/gegl-algorithms.h              | 230 +++++++--------
 gegl/buffer/gegl-buffer-access.c           | 459 ++++++++++++++---------------
 gegl/buffer/gegl-buffer-iterator.c         |  58 ++--
 gegl/buffer/gegl-buffer-iterator.h         |  32 +-
 gegl/buffer/gegl-buffer-iterator2.c        |  62 ++--
 gegl/buffer/gegl-buffer-iterator2.h        |  34 +--
 gegl/buffer/gegl-buffer-linear.c           |  32 +-
 gegl/buffer/gegl-buffer-private.h          |  72 ++---
 gegl/buffer/gegl-buffer-save.c             |   6 +-
 gegl/buffer/gegl-buffer-types.h            |  21 +-
 gegl/buffer/gegl-buffer.c                  |  58 ++--
 gegl/buffer/gegl-buffer.h                  | 160 ++++++----
 gegl/buffer/gegl-sampler-nearest.c         |   2 +-
 gegl/buffer/gegl-sampler.c                 |  26 +-
 gegl/buffer/gegl-sampler.h                 |  18 +-
 gegl/buffer/gegl-tile-backend-buffer.c     |   2 +-
 gegl/buffer/gegl-tile-backend-file-async.c |   6 +-
 gegl/buffer/gegl-tile-backend.c            |   6 +-
 gegl/buffer/gegl-tile-backend.h            |  10 +-
 gegl/buffer/gegl-tile-handler.c            |   4 +-
 gegl/buffer/gegl-tile-handler.h            |   4 +-
 gegl/gegl-types.h                          |  64 ++--
 23 files changed, 771 insertions(+), 740 deletions(-)
---
diff --git a/gegl/buffer/gegl-algorithms.c b/gegl/buffer/gegl-algorithms.c
index ebc44ec6f..36ccaa323 100644
--- a/gegl/buffer/gegl-algorithms.c
+++ b/gegl/buffer/gegl-algorithms.c
@@ -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;
diff --git a/gegl/buffer/gegl-algorithms.h b/gegl/buffer/gegl-algorithms.h
index f208d990b..9461a0ed3 100644
--- a/gegl/buffer/gegl-algorithms.h
+++ b/gegl/buffer/gegl-algorithms.h
@@ -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);
 
diff --git a/gegl/buffer/gegl-buffer-access.c b/gegl/buffer/gegl-buffer-access.c
index 391fd3a72..5e90d1c29 100644
--- a/gegl/buffer/gegl-buffer-access.c
+++ b/gegl/buffer/gegl-buffer-access.c
@@ -40,23 +40,23 @@
 #include "gegl-buffer-iterator-private.h"
 #include "gegl-types-internal.h"
 
-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 GeglRectangle *roi,
-                                               guchar              *buf,
-                                               gint                 rowstride,
-                                               const Babl          *format,
-                                               gint                 level,
-                                               GeglAbyssPolicy      repeat_mode);
+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_dispatch (GeglBuffer                *buffer,
+                                               const GeglBufferRectangle *roi,
+                                               guchar                    *buf,
+                                               gint                       rowstride,
+                                               const Babl                *format,
+                                               gint                       level,
+                                               GeglAbyssPolicy            repeat_mode);
 
 static void inline
 gegl_buffer_get_pixel (GeglBuffer     *buffer,
@@ -66,7 +66,7 @@ gegl_buffer_get_pixel (GeglBuffer     *buffer,
                        gpointer        data,
                        GeglAbyssPolicy repeat_mode)
 {
-  const GeglRectangle *abyss = &buffer->abyss;
+  const GeglBufferRectangle *abyss = &buffer->abyss;
   guchar              *buf   = data;
 
   if (y <  abyss->y ||
@@ -177,8 +177,8 @@ __gegl_buffer_set_pixel (GeglBuffer     *buffer,
                        const Babl     *format,
                        gconstpointer   data)
 {
-  const GeglRectangle *abyss = &buffer->abyss;
-  const guchar        *buf   = data;
+  const GeglBufferRectangle *abyss = &buffer->abyss;
+  const guchar              *buf   = data;
 
   if (y <  abyss->y ||
       x <  abyss->x ||
@@ -260,13 +260,13 @@ enum _GeglBufferSetFlag {
 typedef enum _GeglBufferSetFlag GeglBufferSetFlag;
 
 void
-gegl_buffer_set_with_flags (GeglBuffer          *buffer,
-                            const GeglRectangle *rect,
-                            gint                 level,
-                            const Babl          *format,
-                            const void          *src,
-                            gint                 rowstride,
-                            GeglBufferSetFlag    set_flags);
+gegl_buffer_set_with_flags (GeglBuffer                *buffer,
+                            const GeglBufferRectangle *rect,
+                            gint                       level,
+                            const Babl                *format,
+                            const void                *src,
+                            gint                       rowstride,
+                            GeglBufferSetFlag          set_flags);
 
 
 static inline void
@@ -277,7 +277,7 @@ _gegl_buffer_set_pixel (GeglBuffer       *buffer,
                         gconstpointer     data,
                         GeglBufferSetFlag flags)
 {
-  GeglRectangle rect = {x,y,1,1};
+  GeglBufferRectangle rect = {x,y,1,1};
   switch (flags)
   {
     case GEGL_BUFFER_SET_FLAG_FAST:
@@ -327,7 +327,7 @@ gegl_buffer_flush (GeglBuffer *buffer)
 }
 
 void
-gegl_buffer_flush_ext (GeglBuffer *buffer, const GeglRectangle *rect)
+gegl_buffer_flush_ext (GeglBuffer *buffer, const GeglBufferRectangle *rect)
 {
   if (gegl_buffer_ext_flush)
     gegl_buffer_ext_flush (buffer, rect);
@@ -336,12 +336,12 @@ gegl_buffer_flush_ext (GeglBuffer *buffer, const GeglRectangle *rect)
 
 
 static inline void
-gegl_buffer_iterate_write (GeglBuffer          *buffer,
-                           const GeglRectangle *roi,
-                           guchar              *buf,
-                           gint                 rowstride,
-                           const Babl          *format,
-                           gint                 level)
+gegl_buffer_iterate_write (GeglBuffer                *buffer,
+                           const GeglBufferRectangle *roi,
+                           guchar                    *buf,
+                           gint                       rowstride,
+                           const Babl                *format,
+                           gint                       level)
 {
   gint tile_width  = buffer->tile_storage->tile_width;
   gint tile_height = buffer->tile_storage->tile_height;
@@ -365,7 +365,7 @@ gegl_buffer_iterate_write (GeglBuffer          *buffer,
   gint abyss_y_total  = buffer_abyss_y + buffer->abyss.height;
   gint factor         = 1<<level;
   const Babl *fish;
-  GeglRectangle scaled_rect;
+  GeglBufferRectangle scaled_rect;
   if (level && roi)
   {
     scaled_rect = *roi;
@@ -852,18 +852,18 @@ with multi-threading - and should be added back later.
   if (level == 0)
     {
       gegl_tile_handler_damage_rect (GEGL_TILE_HANDLER (buffer->tile_storage),
-                                     GEGL_RECTANGLE (buffer_x, buffer_y,
-                                                     width,    height));
+                                     GEGL_BUFFER_RECTANGLE (buffer_x, buffer_y,
+                                                            width,    height));
     }
 }
 
 static inline void
-gegl_buffer_set_internal (GeglBuffer          *buffer,
-                          const GeglRectangle *rect,
-                          gint                 level,
-                          const Babl          *format,
-                          const void          *src,
-                          gint                 rowstride)
+gegl_buffer_set_internal (GeglBuffer                *buffer,
+                          const GeglBufferRectangle *rect,
+                          gint                       level,
+                          const Babl                *format,
+                          const void                *src,
+                          gint                       rowstride)
 {
   if (gegl_buffer_ext_flush)
     {
@@ -879,13 +879,13 @@ gegl_buffer_set_internal (GeglBuffer          *buffer,
 }
 
 static void inline
-_gegl_buffer_set_with_flags (GeglBuffer       *buffer,
-                            const GeglRectangle *rect,
-                            gint                 level,
-                            const Babl          *format,
-                            const void          *src,
-                            gint                 rowstride,
-                            GeglBufferSetFlag    flags)
+_gegl_buffer_set_with_flags (GeglBuffer               *buffer,
+                            const GeglBufferRectangle *rect,
+                            gint                       level,
+                            const Babl                *format,
+                            const void                *src,
+                            gint                       rowstride,
+                            GeglBufferSetFlag          flags)
 {
   switch (flags)
   {
@@ -913,13 +913,13 @@ _gegl_buffer_set_with_flags (GeglBuffer       *buffer,
 }
 
 void
-gegl_buffer_set_with_flags (GeglBuffer       *buffer,
-                            const GeglRectangle *rect,
-                            gint                 level,
-                            const Babl          *format,
-                            const void          *src,
-                            gint                 rowstride,
-                            GeglBufferSetFlag    flags)
+gegl_buffer_set_with_flags (GeglBuffer                *buffer,
+                            const GeglBufferRectangle *rect,
+                            gint                       level,
+                            const Babl                *format,
+                            const void                *src,
+                            gint                       rowstride,
+                            GeglBufferSetFlag          flags)
 {
   g_return_if_fail (GEGL_IS_BUFFER (buffer));
   if (format == NULL)
@@ -928,12 +928,12 @@ gegl_buffer_set_with_flags (GeglBuffer       *buffer,
 }
 
 static void
-gegl_buffer_iterate_read_simple (GeglBuffer          *buffer,
-                                 const GeglRectangle *roi,
-                                 guchar              *buf,
-                                 gint                 buf_stride,
-                                 const Babl          *format,
-                                 gint                 level)
+gegl_buffer_iterate_read_simple (GeglBuffer                *buffer,
+                                 const GeglBufferRectangle *roi,
+                                 guchar                    *buf,
+                                 gint                       buf_stride,
+                                 const Babl                *format,
+                                 gint                       level)
 {
   gint tile_width  = buffer->tile_storage->tile_width;
   gint tile_height = buffer->tile_storage->tile_height;
@@ -1280,17 +1280,17 @@ fill_abyss_color (guchar *buf, gint width, gint height, gint buf_stride, guchar
 }
 
 static void
-gegl_buffer_iterate_read_abyss_color (GeglBuffer          *buffer,
-                                      const GeglRectangle *roi,
-                                      const GeglRectangle *abyss,
-                                      guchar              *buf,
-                                      gint                 buf_stride,
-                                      const Babl          *format,
-                                      gint                 level,
-                                      guchar              *color,
-                                      GeglAbyssPolicy      repeat_mode)
+gegl_buffer_iterate_read_abyss_color (GeglBuffer                *buffer,
+                                      const GeglBufferRectangle *roi,
+                                      const GeglBufferRectangle *abyss,
+                                      guchar                    *buf,
+                                      gint                       buf_stride,
+                                      const Babl                *format,
+                                      gint                       level,
+                                      guchar                    *color,
+                                      GeglAbyssPolicy            repeat_mode)
 {
-  GeglRectangle current_roi = *roi;
+  GeglBufferRectangle current_roi = *roi;
   gint bpp = babl_format_get_bytes_per_pixel (format);
 
   if (current_roi.y < abyss->y)
@@ -1310,7 +1310,7 @@ gegl_buffer_iterate_read_abyss_color (GeglBuffer          *buffer,
 
   if (current_roi.height && (current_roi.y < abyss->y + abyss->height))
     {
-      GeglRectangle inner_roi = current_roi;
+      GeglBufferRectangle inner_roi = current_roi;
       guchar *inner_buf       = buf;
 
       if (inner_roi.height + inner_roi.y > abyss->height + abyss->y)
@@ -1391,16 +1391,16 @@ gegl_buffer_iterate_read_abyss_color (GeglBuffer          *buffer,
 }
 
 static void
-gegl_buffer_iterate_read_abyss_clamp (GeglBuffer          *buffer,
-                                      const GeglRectangle *roi,
-                                      const GeglRectangle *abyss,
-                                      guchar              *buf,
-                                      gint                 buf_stride,
-                                      const Babl          *format,
-                                      gint                 level)
+gegl_buffer_iterate_read_abyss_clamp (GeglBuffer                *buffer,
+                                      const GeglBufferRectangle *roi,
+                                      const GeglBufferRectangle *abyss,
+                                      guchar                    *buf,
+                                      gint                       buf_stride,
+                                      const Babl                *format,
+                                      gint                       level)
 {
-  GeglRectangle read_output_rect;
-  GeglRectangle read_input_rect;
+  GeglBufferRectangle read_output_rect;
+  GeglBufferRectangle read_input_rect;
 
   gint    bpp           = babl_format_get_bytes_per_pixel (format);
   gint    x_read_offset = 0;
@@ -1423,10 +1423,10 @@ gegl_buffer_iterate_read_abyss_clamp (GeglBuffer          *buffer,
   /* Intersect our shifted abyss with the roi */
   gegl_rectangle_intersect (&read_output_rect,
                             roi,
-                            GEGL_RECTANGLE (abyss->x + x_read_offset,
-                                            abyss->y + y_read_offset,
-                                            abyss->width,
-                                            abyss->height));
+                            GEGL_BUFFER_RECTANGLE (abyss->x + x_read_offset,
+                                                   abyss->y + y_read_offset,
+                                                   abyss->width,
+                                                   abyss->height));
 
   /* Offset into *buf based on the intersected rect's x & y */
   buf_offset_cols = read_output_rect.x - roi->x;
@@ -1565,15 +1565,15 @@ gegl_buffer_iterate_read_abyss_clamp (GeglBuffer          *buffer,
 }
 
 static void
-gegl_buffer_iterate_read_abyss_loop (GeglBuffer          *buffer,
-                                     const GeglRectangle *roi,
-                                     const GeglRectangle *abyss,
-                                     guchar              *buf,
-                                     gint                 buf_stride,
-                                     const Babl          *format,
-                                     gint                 level)
+gegl_buffer_iterate_read_abyss_loop (GeglBuffer                *buffer,
+                                     const GeglBufferRectangle *roi,
+                                     const GeglBufferRectangle *abyss,
+                                     guchar                    *buf,
+                                     gint                       buf_stride,
+                                     const Babl                *format,
+                                     gint                       level)
 {
-  GeglRectangle current_roi;
+  GeglBufferRectangle current_roi;
   gint          bpp = babl_format_get_bytes_per_pixel (format);
   gint          origin_x;
 
@@ -1596,14 +1596,14 @@ gegl_buffer_iterate_read_abyss_loop (GeglBuffer          *buffer,
 
       while (current_roi.x < roi->x + roi->width)
         {
-          GeglRectangle simple_roi;
+          GeglBufferRectangle simple_roi;
           gegl_rectangle_intersect (&simple_roi, &current_roi, roi);
 
           gegl_buffer_iterate_read_simple (buffer,
-                                           GEGL_RECTANGLE (abyss->x + (simple_roi.x - current_roi.x),
-                                                           abyss->y + (simple_roi.y - current_roi.y),
-                                                           simple_roi.width,
-                                                           simple_roi.height),
+                                           GEGL_BUFFER_RECTANGLE (abyss->x + (simple_roi.x - current_roi.x),
+                                                                  abyss->y + (simple_roi.y - current_roi.y),
+                                                                  simple_roi.width,
+                                                                  simple_roi.height),
                                            inner_buf,
                                            buf_stride,
                                            format,
@@ -1623,13 +1623,13 @@ gegl_buffer_iterate_read_abyss_loop (GeglBuffer          *buffer,
 }
 
 static gpointer
-gegl_buffer_read_at_level (GeglBuffer          *buffer,
-                           const GeglRectangle *roi,
-                           guchar              *buf,
-                           gint                 rowstride,
-                           const Babl          *format,
-                           gint                 level,
-                           GeglAbyssPolicy      repeat_mode)
+gegl_buffer_read_at_level (GeglBuffer                *buffer,
+                           const GeglBufferRectangle *roi,
+                           guchar                    *buf,
+                           gint                       rowstride,
+                           const Babl                *format,
+                           gint                       level,
+                           GeglAbyssPolicy            repeat_mode)
 {
   gint bpp = babl_format_get_bytes_per_pixel (format);
 
@@ -1653,7 +1653,7 @@ gegl_buffer_read_at_level (GeglBuffer          *buffer,
   else
     {
       gpointer scratch;
-      GeglRectangle next_roi;
+      GeglBufferRectangle next_roi;
       next_roi.x = roi->x * 2;
       next_roi.y = roi->y * 2;
       next_roi.width = roi->width * 2;
@@ -1662,8 +1662,8 @@ gegl_buffer_read_at_level (GeglBuffer          *buffer,
       /* If the next block is too big split it in half */
       if (next_roi.width * next_roi.height > 256 * 256)
         {
-          GeglRectangle next_roi_a = next_roi;
-          GeglRectangle next_roi_b = next_roi;
+          GeglBufferRectangle next_roi_a = next_roi;
+          GeglBufferRectangle next_roi_b = next_roi;
           gint scratch_stride = next_roi.width * bpp;
           gpointer scratch_a;
           gpointer scratch_b;
@@ -1724,14 +1724,14 @@ gegl_buffer_read_at_level (GeglBuffer          *buffer,
 }
 
 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)
+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)
 {
   gint x = roi->x;
   gint y = roi->y;
@@ -1743,7 +1743,7 @@ gegl_buffer_iterate_read_fringed (GeglBuffer          *buffer,
 
   if (x <= abyss->x)
     {
-      GeglRectangle fringe_roi = {x, y, 1, height};
+      GeglBufferRectangle fringe_roi = {x, y, 1, height};
       guchar *fringe_buf = inner_buf;
 
       gegl_buffer_read_at_level (buffer, &fringe_roi, fringe_buf, buf_stride, format, level, repeat_mode);
@@ -1757,7 +1757,7 @@ gegl_buffer_iterate_read_fringed (GeglBuffer          *buffer,
 
   if (y <= abyss->y)
     {
-      GeglRectangle fringe_roi = {x, y, width, 1};
+      GeglBufferRectangle fringe_roi = {x, y, width, 1};
       guchar *fringe_buf = inner_buf;
 
       gegl_buffer_read_at_level (buffer, &fringe_roi, fringe_buf, buf_stride, format, level, repeat_mode);
@@ -1771,7 +1771,7 @@ gegl_buffer_iterate_read_fringed (GeglBuffer          *buffer,
 
   if (y + height >= abyss->y + abyss->height)
     {
-      GeglRectangle fringe_roi = {x, y + height - 1, width, 1};
+      GeglBufferRectangle fringe_roi = {x, y + height - 1, width, 1};
       guchar *fringe_buf = inner_buf + (height - 1) * buf_stride;
 
       gegl_buffer_read_at_level (buffer, &fringe_roi, fringe_buf, buf_stride, format, level, repeat_mode);
@@ -1783,7 +1783,7 @@ gegl_buffer_iterate_read_fringed (GeglBuffer          *buffer,
 
   if (x + width >= abyss->x + abyss->width)
     {
-      GeglRectangle fringe_roi = {x + width - 1, y, 1, height};
+      GeglBufferRectangle fringe_roi = {x + width - 1, y, 1, height};
       guchar *fringe_buf = inner_buf + (width - 1) * bpp;
 
       gegl_buffer_read_at_level (buffer, &fringe_roi, fringe_buf, buf_stride, format, level, repeat_mode);
@@ -1794,7 +1794,7 @@ gegl_buffer_iterate_read_fringed (GeglBuffer          *buffer,
     }
 
   gegl_buffer_iterate_read_simple (buffer,
-                                   GEGL_RECTANGLE (x, y, width, height),
+                                   GEGL_BUFFER_RECTANGLE (x, y, width, height),
                                    inner_buf,
                                    buf_stride,
                                    format,
@@ -1802,17 +1802,17 @@ gegl_buffer_iterate_read_fringed (GeglBuffer          *buffer,
 }
 
 static void
-gegl_buffer_iterate_read_dispatch (GeglBuffer          *buffer,
-                                   const GeglRectangle *roi,
-                                   guchar              *buf,
-                                   gint                 rowstride,
-                                   const Babl          *format,
-                                   gint                 level,
-                                   GeglAbyssPolicy      repeat_mode)
+gegl_buffer_iterate_read_dispatch (GeglBuffer                *buffer,
+                                   const GeglBufferRectangle *roi,
+                                   guchar                    *buf,
+                                   gint                       rowstride,
+                                   const Babl                *format,
+                                   gint                       level,
+                                   GeglAbyssPolicy            repeat_mode)
 {
-  GeglRectangle abyss          = buffer->abyss;
-  GeglRectangle abyss_factored = abyss;
-  GeglRectangle roi_factored   = *roi;
+  GeglBufferRectangle abyss          = buffer->abyss;
+  GeglBufferRectangle abyss_factored = abyss;
+  GeglBufferRectangle roi_factored   = *roi;
 
   if (level)
     {
@@ -1900,24 +1900,24 @@ gegl_buffer_iterate_read_dispatch (GeglBuffer          *buffer,
 }
 
 void
-gegl_buffer_set_unlocked (GeglBuffer          *buffer,
-                          const GeglRectangle *rect,
-                          gint                 level,
-                          const Babl          *format,
-                          const void          *src,
-                          gint                 rowstride)
+gegl_buffer_set_unlocked (GeglBuffer                *buffer,
+                          const GeglBufferRectangle *rect,
+                          gint                       level,
+                          const Babl                *format,
+                          const void                *src,
+                          gint                       rowstride)
 {
   _gegl_buffer_set_with_flags (buffer, rect, level, format, src, rowstride,
                                GEGL_BUFFER_SET_FLAG_NOTIFY);
 }
 
 void
-gegl_buffer_set_unlocked_no_notify (GeglBuffer          *buffer,
-                                    const GeglRectangle *rect,
-                                    gint                 level,
-                                    const Babl          *format,
-                                    const void          *src,
-                                    gint                 rowstride)
+gegl_buffer_set_unlocked_no_notify (GeglBuffer                *buffer,
+                                    const GeglBufferRectangle *rect,
+                                    gint                       level,
+                                    const Babl                *format,
+                                    const void                *src,
+                                    gint                       rowstride)
 {
   _gegl_buffer_set_with_flags (buffer, rect, level, format, src, rowstride,
                                GEGL_BUFFER_SET_FLAG_FAST);
@@ -1925,12 +1925,12 @@ gegl_buffer_set_unlocked_no_notify (GeglBuffer          *buffer,
 
 
 void
-gegl_buffer_set (GeglBuffer          *buffer,
-                 const GeglRectangle *rect,
-                 gint                 level,
-                 const Babl          *format,
-                 const void          *src,
-                 gint                 rowstride)
+gegl_buffer_set (GeglBuffer                *buffer,
+                 const GeglBufferRectangle *rect,
+                 gint                       level,
+                 const Babl                *format,
+                 const void                *src,
+                 gint                       rowstride)
 {
   g_return_if_fail (GEGL_IS_BUFFER (buffer));
   if (format == NULL)
@@ -1968,9 +1968,9 @@ gegl_buffer_set (GeglBuffer          *buffer,
 /* Expand roi by scale so it uncludes all pixels needed
  * to satisfy a gegl_buffer_get() call at level 0.
  */
-GeglRectangle
-_gegl_get_required_for_scale (const GeglRectangle *roi,
-                              gdouble              scale)
+GeglBufferRectangle
+_gegl_get_required_for_scale (const GeglBufferRectangle *roi,
+                              gdouble                    scale)
 {
   if (GEGL_FLOAT_EQUAL (scale, 1.0))
     return *roi;
@@ -1985,29 +1985,26 @@ _gegl_get_required_for_scale (const GeglRectangle *roi,
 
       if (scale < 1.0)
         {
-          return *GEGL_RECTANGLE (x1 - pad,
-                                  y1 - pad,
-                                  x2 - x1 + 2 * pad,
-                                  y2 - y1 + 2 * pad);
+          return *GEGL_BUFFER_RECTANGLE (x1 - pad, y1 - pad,
+                                         x2 - x1 + 2 * pad, y2 - y1 + 2 * pad);
         }
       else
         {
-          return *GEGL_RECTANGLE (x1,
-                                  y1,
-                                  x2 - x1,
-                                  y2 - y1);
+          return *GEGL_BUFFER_RECTANGLE (x1, y1,
+                                         x2 - x1,
+                                         y2 - y1);
         }
       }
 }
 
 static inline void
-_gegl_buffer_get_unlocked (GeglBuffer          *buffer,
-                           gdouble              scale,
-                           const GeglRectangle *rect,
-                           const Babl          *format,
-                           gpointer             dest_buf,
-                           gint                 rowstride,
-                           GeglAbyssPolicy      flags)
+_gegl_buffer_get_unlocked (GeglBuffer                *buffer,
+                           gdouble                    scale,
+                           const GeglBufferRectangle *rect,
+                           const Babl                *format,
+                           gpointer                   dest_buf,
+                           gint                       rowstride,
+                           GeglAbyssPolicy            flags)
 {
   GeglAbyssPolicy repeat_mode = flags & 0x7; /* mask off interpolation from repeat mode part of flags */
 
@@ -2075,7 +2072,7 @@ _gegl_buffer_get_unlocked (GeglBuffer          *buffer,
   else
   {
     gint chunk_height;
-    GeglRectangle rect2       = *rect;
+    GeglBufferRectangle rect2 = *rect;
     gint    bpp               = babl_format_get_bytes_per_pixel (format);
     gint    ystart            = rect->y;
     float   scale_orig        = scale;
@@ -2144,7 +2141,7 @@ _gegl_buffer_get_unlocked (GeglBuffer          *buffer,
 
     while (rect2.width > 0 && rect2.height > 0)
     {
-      GeglRectangle sample_rect;
+      GeglBufferRectangle sample_rect;
       gint    buf_width, buf_height;
       gint    y1 = floorf (rect2.y / scale_orig + GEGL_SCALE_EPSILON);
       gint    y2 = ceilf ((rect2.y + rect2.height) / scale_orig - GEGL_SCALE_EPSILON);
@@ -2275,25 +2272,25 @@ setup_next_chunk:
 }
 
 void
-gegl_buffer_get_unlocked (GeglBuffer          *buffer,
-                          gdouble              scale,
-                          const GeglRectangle *rect,
-                          const Babl          *format,
-                          gpointer             dest_buf,
-                          gint                 rowstride,
-                          GeglAbyssPolicy      repeat_mode)
+gegl_buffer_get_unlocked (GeglBuffer                *buffer,
+                          gdouble                    scale,
+                          const GeglBufferRectangle *rect,
+                          const Babl                *format,
+                          gpointer                   dest_buf,
+                          gint                       rowstride,
+                          GeglAbyssPolicy            repeat_mode)
 {
   return _gegl_buffer_get_unlocked (buffer, scale, rect, format, dest_buf, rowstride, repeat_mode);
 }
 
 void
-gegl_buffer_get (GeglBuffer          *buffer,
-                 const GeglRectangle *rect,
-                 gdouble              scale,
-                 const Babl          *format,
-                 gpointer             dest_buf,
-                 gint                 rowstride,
-                 GeglAbyssPolicy      repeat_mode)
+gegl_buffer_get (GeglBuffer                *buffer,
+                 const GeglBufferRectangle *rect,
+                 gdouble                    scale,
+                 const Babl                *format,
+                 gpointer                   dest_buf,
+                 gint                       rowstride,
+                 GeglAbyssPolicy            repeat_mode)
 {
   g_return_if_fail (GEGL_IS_BUFFER (buffer));
   gegl_buffer_lock (buffer);
@@ -2302,11 +2299,11 @@ gegl_buffer_get (GeglBuffer          *buffer,
 }
 
 static void
-gegl_buffer_copy2 (GeglBuffer          *src,
-                   const GeglRectangle *src_rect,
-                   GeglAbyssPolicy      repeat_mode,
-                   GeglBuffer          *dst,
-                   const GeglRectangle *dst_rect)
+gegl_buffer_copy2 (GeglBuffer                *src,
+                   const GeglBufferRectangle *src_rect,
+                   GeglAbyssPolicy            repeat_mode,
+                   GeglBuffer                *dst,
+                   const GeglBufferRectangle *dst_rect)
 {
   GeglBufferIterator *i;
   gint offset_x = src_rect->x - dst_rect->x;
@@ -2317,7 +2314,7 @@ gegl_buffer_copy2 (GeglBuffer          *src,
                                 repeat_mode, 1);
   while (gegl_buffer_iterator_next (i))
     {
-      GeglRectangle src_rect = i->items[0].roi;
+      GeglBufferRectangle src_rect = i->items[0].roi;
       src_rect.x += offset_x;
       src_rect.y += offset_y;
       gegl_buffer_iterate_read_dispatch (src, &src_rect, i->items[0].data, 0,
@@ -2326,13 +2323,13 @@ gegl_buffer_copy2 (GeglBuffer          *src,
 }
 
 void
-gegl_buffer_copy (GeglBuffer          *src,
-                  const GeglRectangle *src_rect,
-                  GeglAbyssPolicy      repeat_mode,
-                  GeglBuffer          *dst,
-                  const GeglRectangle *dst_rect)
+gegl_buffer_copy (GeglBuffer                *src,
+                  const GeglBufferRectangle *src_rect,
+                  GeglAbyssPolicy            repeat_mode,
+                  GeglBuffer                *dst,
+                  const GeglBufferRectangle *dst_rect)
 {
-  GeglRectangle dest_rect_r;
+  GeglBufferRectangle dest_rect_r;
 
   g_return_if_fail (GEGL_IS_BUFFER (src));
   g_return_if_fail (GEGL_IS_BUFFER (dst));
@@ -2367,7 +2364,7 @@ gegl_buffer_copy (GeglBuffer          *src,
       gint tile_width  = dst->tile_width;
       gint tile_height = dst->tile_height;
 
-      GeglRectangle cow_rect = *dst_rect;
+      GeglBufferRectangle cow_rect = *dst_rect;
       gint          rem;
 
       /* adjust origin to match the start of tile alignment */
@@ -2389,7 +2386,7 @@ gegl_buffer_copy (GeglBuffer          *src,
 
       if (cow_rect.width > 0 && cow_rect.height > 0)
         {
-          GeglRectangle top, bottom, left, right;
+          GeglBufferRectangle top, bottom, left, right;
 
           /* iterate over rectangle that can be cow copied, duplicating
            * one and one tile
@@ -2493,27 +2490,27 @@ gegl_buffer_copy (GeglBuffer          *src,
 
           if (top.height)
           gegl_buffer_copy2 (src,
-                             GEGL_RECTANGLE (src_rect->x + (top.x-dst_rect->x),
+                             GEGL_BUFFER_RECTANGLE (src_rect->x + (top.x-dst_rect->x),
                                              src_rect->y + (top.y-dst_rect->y),
-                                 top.width, top.height),
+                                             top.width, top.height),
                              repeat_mode, dst, &top);
           if (bottom.height)
           gegl_buffer_copy2 (src,
-                             GEGL_RECTANGLE (src_rect->x + (bottom.x-dst_rect->x),
-                                             src_rect->y + (bottom.y-dst_rect->y),
-                                 bottom.width, bottom.height),
+                             GEGL_BUFFER_RECTANGLE (src_rect->x + (bottom.x-dst_rect->x),
+                                                    src_rect->y + (bottom.y-dst_rect->y),
+                                                    bottom.width, bottom.height),
                              repeat_mode, dst, &bottom);
           if (left.width && left.height)
           gegl_buffer_copy2 (src,
-                             GEGL_RECTANGLE (src_rect->x + (left.x-dst_rect->x),
-                                             src_rect->y + (left.y-dst_rect->y),
-                                 left.width, left.height),
+                             GEGL_BUFFER_RECTANGLE (src_rect->x + (left.x-dst_rect->x),
+                                                    src_rect->y + (left.y-dst_rect->y),
+                                                    left.width, left.height),
                              repeat_mode, dst, &left);
           if (right.width && right.height)
           gegl_buffer_copy2 (src,
-                             GEGL_RECTANGLE (src_rect->x + (right.x-dst_rect->x),
-                                             src_rect->y + (right.y-dst_rect->y),
-                                 right.width, right.height),
+                             GEGL_BUFFER_RECTANGLE (src_rect->x + (right.x-dst_rect->x),
+                                                    src_rect->y + (right.y-dst_rect->y),
+                                                    right.width, right.height),
                              repeat_mode, dst, &right);
         }
       else
@@ -2530,8 +2527,8 @@ gegl_buffer_copy (GeglBuffer          *src,
 }
 
 static void
-gegl_buffer_clear2 (GeglBuffer          *dst,
-                    const GeglRectangle *dst_rect)
+gegl_buffer_clear2 (GeglBuffer                *dst,
+                    const GeglBufferRectangle *dst_rect)
 {
   GeglBufferIterator *i;
   gint                pxsize;
@@ -2553,8 +2550,8 @@ gegl_buffer_clear2 (GeglBuffer          *dst,
 }
 
 void
-gegl_buffer_clear (GeglBuffer          *dst,
-                   const GeglRectangle *dst_rect)
+gegl_buffer_clear (GeglBuffer                *dst,
+                   const GeglBufferRectangle *dst_rect)
 {
   g_return_if_fail (GEGL_IS_BUFFER (dst));
 
@@ -2575,7 +2572,7 @@ gegl_buffer_clear (GeglBuffer          *dst,
       gint tile_width  = dst->tile_width;
       gint tile_height = dst->tile_height;
 
-      GeglRectangle cow_rect = *dst_rect;
+      GeglBufferRectangle cow_rect = *dst_rect;
       gint          rem;
 
       /* adjust origin to match the start of tile alignment */
@@ -2597,7 +2594,7 @@ gegl_buffer_clear (GeglBuffer          *dst,
 
       if (cow_rect.width > 0 && cow_rect.height > 0)
         {
-          GeglRectangle top, bottom, left, right;
+          GeglBufferRectangle top, bottom, left, right;
 
           /* iterate over rectangle that can be cow copied, duplicating
            * one and one tile
@@ -2670,17 +2667,17 @@ gegl_buffer_clear (GeglBuffer          *dst,
 }
 
 void
-gegl_buffer_set_pattern (GeglBuffer          *buffer,
-                         const GeglRectangle *rect,
-                         GeglBuffer          *pattern,
-                         gint                 x_offset,
-                         gint                 y_offset)
+gegl_buffer_set_pattern (GeglBuffer                *buffer,
+                         const GeglBufferRectangle *rect,
+                         GeglBuffer                *pattern,
+                         gint                       x_offset,
+                         gint                       y_offset)
 {
-  const GeglRectangle *pattern_extent;
+  const GeglBufferRectangle *pattern_extent;
   const Babl          *buffer_format;
-  GeglRectangle        roi;                  /* the rect if not NULL, else the whole buffer */
-  GeglRectangle        pattern_data_extent;  /* pattern_extent clamped to rect */
-  GeglRectangle        extended_data_extent; /* many patterns to avoid copying too small chunks of data */
+  GeglBufferRectangle        roi;                  /* the rect if not NULL, else the whole buffer */
+  GeglBufferRectangle        pattern_data_extent;  /* pattern_extent clamped to rect */
+  GeglBufferRectangle        extended_data_extent; /* many patterns to avoid copying too small chunks of 
data */
   gint                 bpp;
   gint                 x, y;
   gint                 rowstride;
@@ -2760,7 +2757,7 @@ gegl_buffer_set_pattern (GeglBuffer          *buffer,
   for (y = roi.y; y < roi.y + roi.height; y += extended_data_extent.height)
     for (x = roi.x; x < roi.x + roi.width; x += extended_data_extent.width)
       {
-        GeglRectangle dest_rect = {x, y,
+        GeglBufferRectangle dest_rect = {x, y,
                                    extended_data_extent.width,
                                    extended_data_extent.height};
 
@@ -2774,10 +2771,10 @@ gegl_buffer_set_pattern (GeglBuffer          *buffer,
 }
 
 void
-gegl_buffer_set_color_from_pixel (GeglBuffer          *dst,
-                                  const GeglRectangle *dst_rect,
-                                  const uint8_t       *pixel,
-                                  const Babl          *pixel_format)
+gegl_buffer_set_color_from_pixel (GeglBuffer                *dst,
+                                  const GeglBufferRectangle *dst_rect,
+                                  const uint8_t             *pixel,
+                                  const Babl                *pixel_format)
 {
   GeglBufferIterator *i;
   gint                bpp;
diff --git a/gegl/buffer/gegl-buffer-iterator.c b/gegl/buffer/gegl-buffer-iterator.c
index 22b6af83c..672c1b7e4 100644
--- a/gegl/buffer/gegl-buffer-iterator.c
+++ b/gegl/buffer/gegl-buffer-iterator.c
@@ -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;
diff --git a/gegl/buffer/gegl-buffer-iterator.h b/gegl/buffer/gegl-buffer-iterator.h
index 671937786..ba0f1bc33 100644
--- a/gegl/buffer/gegl-buffer-iterator.h
+++ b/gegl/buffer/gegl-buffer-iterator.h
@@ -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,
-                                                GeglBuffer          *buffer,
-                                                const GeglRectangle *roi,
-                                                gint                 level,
-                                                const Babl          *format,
-                                                GeglAccessMode       access_mode,
-                                                GeglAbyssPolicy      abyss_policy);
+gint                 gegl_buffer_iterator_add  (GeglBufferIterator        *iterator,
+                                                GeglBuffer                *buffer,
+                                                const GeglBufferRectangle *roi,
+                                                gint                       level,
+                                                const Babl                *format,
+                                                GeglAccessMode             access_mode,
+                                                GeglAbyssPolicy            abyss_policy);
 
 /**
  * gegl_buffer_iterator_stop: (skip)
diff --git a/gegl/buffer/gegl-buffer-iterator2.c b/gegl/buffer/gegl-buffer-iterator2.c
index 89cf7ff54..e32996093 100644
--- a/gegl/buffer/gegl-buffer-iterator2.c
+++ b/gegl/buffer/gegl-buffer-iterator2.c
@@ -51,7 +51,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;
@@ -59,7 +59,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;
@@ -72,12 +72,12 @@ typedef struct _SubIterState {
 
 struct _GeglBufferIterator2Priv
 {
-  gint              num_buffers;
-  GeglIteratorState state;
-  GeglRectangle     origin_tile;
-  gint              remaining_rows;
-  gint              max_slots;
-  SubIterState      sub_iter[];
+  gint                num_buffers;
+  GeglIteratorState   state;
+  GeglBufferRectangle origin_tile;
+  gint                remaining_rows;
+  gint                max_slots;
+  SubIterState        sub_iter[];
   /* gint           access_order[]; */ /* allocated, but accessed through
                                         * get_access_order().
                                         */
@@ -119,13 +119,13 @@ gegl_buffer_iterator2_empty_new (gint max_slots)
 
 
 static inline int
-_gegl_buffer_iterator2_add (GeglBufferIterator2  *iter,
-                          GeglBuffer          *buf,
-                          const GeglRectangle *roi,
-                          gint                 level,
-                          const Babl          *format,
-                          GeglAccessMode       access_mode,
-                          GeglAbyssPolicy      abyss_policy)
+_gegl_buffer_iterator2_add (GeglBufferIterator2       *iter,
+                            GeglBuffer                *buf,
+                            const GeglBufferRectangle *roi,
+                            gint                       level,
+                            const Babl                *format,
+                            GeglAccessMode             access_mode,
+                            GeglAbyssPolicy            abyss_policy)
 {
   GeglBufferIterator2Priv *priv = iter->priv;
   int                     index;
@@ -170,13 +170,13 @@ _gegl_buffer_iterator2_add (GeglBufferIterator2  *iter,
 }
 
 int
-gegl_buffer_iterator2_add (GeglBufferIterator2  *iter,
-                          GeglBuffer          *buf,
-                          const GeglRectangle *roi,
-                          gint                 level,
-                          const Babl          *format,
-                          GeglAccessMode       access_mode,
-                          GeglAbyssPolicy      abyss_policy)
+gegl_buffer_iterator2_add (GeglBufferIterator2      *iter,
+                          GeglBuffer                *buf,
+                          const GeglBufferRectangle *roi,
+                          gint                       level,
+                          const Babl                *format,
+                          GeglAccessMode             access_mode,
+                          GeglAbyssPolicy            abyss_policy)
 {
   return _gegl_buffer_iterator2_add (iter, buf, roi, level, format, access_mode,
 abyss_policy);
@@ -184,13 +184,13 @@ abyss_policy);
 
 
 GeglBufferIterator2 *
-gegl_buffer_iterator2_new (GeglBuffer          *buf,
-                          const GeglRectangle *roi,
-                          gint                 level,
-                          const Babl          *format,
-                          GeglAccessMode       access_mode,
-                          GeglAbyssPolicy      abyss_policy,
-                          gint                 max_slots)
+gegl_buffer_iterator2_new (GeglBuffer                *buf,
+                          const GeglBufferRectangle *roi,
+                          gint                       level,
+                          const Babl                *format,
+                          GeglAccessMode             access_mode,
+                          GeglAbyssPolicy            abyss_policy,
+                          gint                       max_slots)
 {
   GeglBufferIterator2 *iter = _gegl_buffer_iterator2_empty_new (max_slots);
   _gegl_buffer_iterator2_add (iter, buf, roi, level, format,
@@ -260,7 +260,7 @@ retile_subs (GeglBufferIterator2 *iter,
              int                 y)
 {
   GeglBufferIterator2Priv *priv = iter->priv;
-  GeglRectangle real_roi;
+  GeglBufferRectangle real_roi;
   int index;
 
   int shift_x = priv->origin_tile.x;
@@ -605,7 +605,7 @@ _gegl_buffer_iterator2_stop (GeglBufferIterator2 *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;
diff --git a/gegl/buffer/gegl-buffer-iterator2.h b/gegl/buffer/gegl-buffer-iterator2.h
index caa87aa12..c1e0cd612 100644
--- a/gegl/buffer/gegl-buffer-iterator2.h
+++ b/gegl/buffer/gegl-buffer-iterator2.h
@@ -34,13 +34,13 @@ typedef struct _GeglBufferIterator2Priv GeglBufferIterator2Priv;
 
 typedef struct GeglBufferIterator2Item
 {
-  gpointer      data;
-  GeglRectangle roi;
+  gpointer            data;
+  GeglBufferRectangle roi;
 } GeglBufferIterator2Item;
 
 typedef struct GeglBufferIterator2
 {
-  gint           length;
+  gint                     length;
   GeglBufferIterator2Priv *priv;
   GeglBufferIterator2Item  items[];
 } GeglBufferIterator2;
@@ -73,13 +73,13 @@ GeglBufferIterator2 *gegl_buffer_iterator2_empty_new (int max_slots);
  * buffers pixels.
  */
 GeglBufferIterator2 * gegl_buffer_iterator2_new  (
-                                                 GeglBuffer          *buffer,
-                                                 const GeglRectangle *roi,
-                                                 gint                 level,
-                                                 const Babl          *format,
-                                                 GeglAccessMode       access_mode,
-                                                 GeglAbyssPolicy      abyss_policy,
-                                                 gint                 max_slots);
+                                                 GeglBuffer                *buffer,
+                                                 const GeglBufferRectangle *roi,
+                                                 gint                       level,
+                                                 const Babl                *format,
+                                                 GeglAccessMode             access_mode,
+                                                 GeglAbyssPolicy            abyss_policy,
+                                                 gint                       max_slots);
 
 
 /**
@@ -111,13 +111,13 @@ GeglBufferIterator2 * gegl_buffer_iterator2_new  (
  * Returns: an integer handle refering to the indice in the iterator structure
  * of the added buffer.
  */
-gint                 gegl_buffer_iterator2_add  (GeglBufferIterator2  *iterator,
-                                                GeglBuffer          *buffer,
-                                                const GeglRectangle *roi,
-                                                gint                 level,
-                                                const Babl          *format,
-                                                GeglAccessMode       access_mode,
-                                                GeglAbyssPolicy      abyss_policy);
+gint                gegl_buffer_iterator2_add  (GeglBufferIterator2       *iterator,
+                                                GeglBuffer                *buffer,
+                                                const GeglBufferRectangle *roi,
+                                                gint                       level,
+                                                const Babl                *format,
+                                                GeglAccessMode             access_mode,
+                                                GeglAbyssPolicy            abyss_policy);
 
 /**
  * gegl_buffer_iterator2_stop: (skip)
diff --git a/gegl/buffer/gegl-buffer-linear.c b/gegl/buffer/gegl-buffer-linear.c
index a342a3a13..22a971be9 100644
--- a/gegl/buffer/gegl-buffer-linear.c
+++ b/gegl/buffer/gegl-buffer-linear.c
@@ -13,8 +13,8 @@
 #include "gegl-tile-handler-cache.h"
 
 GeglBuffer *
-gegl_buffer_linear_new (const GeglRectangle *extent,
-                        const Babl          *format)
+gegl_buffer_linear_new (const GeglBufferRectangle *extent,
+                        const Babl                *format)
 {
   GeglBuffer *buffer;
 
@@ -56,12 +56,12 @@ void gegl_tile_handler_cache_insert (GeglTileHandlerCache *cache,
                                      gint                  z);
 
 GeglBuffer *
-gegl_buffer_linear_new_from_data (const gpointer       data,
-                                  const Babl          *format,
-                                  const GeglRectangle *extent,
-                                  gint                 rowstride,
-                                  GDestroyNotify       destroy_fn,
-                                  gpointer             destroy_fn_data)
+gegl_buffer_linear_new_from_data (const gpointer             data,
+                                  const Babl                *format,
+                                  const GeglBufferRectangle *extent,
+                                  gint                       rowstride,
+                                  GDestroyNotify             destroy_fn,
+                                  gpointer                   destroy_fn_data)
 {
   GeglBuffer *buffer;
   GeglTile   *tile;
@@ -123,20 +123,20 @@ gegl_buffer_linear_new_from_data (const gpointer       data,
  * an immediate shared access to the linear buffer.
  */
 typedef struct {
-  gpointer       buf;
-  GeglRectangle  extent;
-  const Babl    *format;
-  gint           refs;
+  gpointer             buf;
+  GeglBufferRectangle  extent;
+  const Babl          *format;
+  gint                 refs;
 } BufferInfo;
 
 /* FIXME: make this use direct data access in more cases than the
  * case of the base buffer.
  */
 gpointer
-gegl_buffer_linear_open (GeglBuffer          *buffer,
-                         const GeglRectangle *extent,   /* if NULL, use buf  */
-                         gint                *rowstride,/* returns rowstride */
-                         const Babl          *format)   /* if NULL, from buf */
+gegl_buffer_linear_open (GeglBuffer                *buffer,
+                         const GeglBufferRectangle *extent,   /* if NULL, use buf  */
+                         gint                      *rowstride,/* returns rowstride */
+                         const Babl                *format)   /* if NULL, from buf */
 {
   if (!format)
     format = buffer->soft_format;
diff --git a/gegl/buffer/gegl-buffer-private.h b/gegl/buffer/gegl-buffer-private.h
index 0c507ce22..b2c86536c 100644
--- a/gegl/buffer/gegl-buffer-private.h
+++ b/gegl/buffer/gegl-buffer-private.h
@@ -33,22 +33,22 @@ typedef struct _GeglBufferClass GeglBufferClass;
 
 struct _GeglBuffer
 {
-  GeglTileHandler   parent_instance; /* which is a GeglTileHandler which has a
+  GeglTileHandler     parent_instance; /* which is a GeglTileHandler which has a
                                         source field which is used for chaining
                                         sub buffers with their anchestors */
 
-  GeglRectangle     extent;        /* the dimensions of the buffer */
+  GeglBufferRectangle extent;        /* the dimensions of the buffer */
 
-  const Babl       *format;  /* the pixel format used for pixels in this
+  const Babl         *format;  /* the pixel format used for pixels in this
                                 buffer */
-  const Babl  *soft_format;  /* the format the buffer pretends to be, might
-                                be different from format */
+  const Babl         *soft_format;  /* the format the buffer pretends to be, might
+                                       be different from format */
 
   gint              shift_x; /* The relative offset of origins compared with */
   gint              shift_y; /* anchestral tile_storage buffer, during       */
                              /* construction relative to immediate source    */
 
-  GeglRectangle     abyss;
+  GeglBufferRectangle abyss;
   gboolean          abyss_tracks_extent; /* specifies whether the abyss rectangle
                                             should track any modifications to the
                                             extent rectangle */
@@ -106,33 +106,33 @@ gboolean          gegl_buffer_lock        (GeglBuffer *buffer);
 gboolean          gegl_buffer_unlock      (GeglBuffer *buffer);
 #endif
 
-void              gegl_buffer_set_unlocked (GeglBuffer          *buffer,
-                                            const GeglRectangle *rect,
-                                            gint                 level,
-                                            const Babl          *format,
-                                            const void          *src,
-                                            gint                 rowstride);
-
-void              gegl_buffer_set_unlocked_no_notify (GeglBuffer          *buffer,
-                                                      const GeglRectangle *rect,
-                                                      gint                 level,
-                                                      const Babl          *format,
-                                                      const void          *src,
-                                                      gint                 rowstride);
-
-void              gegl_buffer_get_unlocked (GeglBuffer          *buffer,
-                                            gdouble              scale,
-                                            const GeglRectangle *rect,
-                                            const Babl          *format,
-                                            gpointer             dest_buf,
-                                            gint                 rowstride,
-                                            GeglAbyssPolicy      repeat_mode);
-
-GeglBuffer *      gegl_buffer_new_ram     (const GeglRectangle *extent,
-                                           const Babl          *format);
+void              gegl_buffer_set_unlocked (GeglBuffer                *buffer,
+                                            const GeglBufferRectangle *rect,
+                                            gint                       level,
+                                            const Babl                *format,
+                                            const void                *src,
+                                            gint                       rowstride);
+
+void              gegl_buffer_set_unlocked_no_notify (GeglBuffer                *buffer,
+                                                      const GeglBufferRectangle *rect,
+                                                      gint                       level,
+                                                      const Babl                *format,
+                                                      const void                *src,
+                                                      gint                       rowstride);
+
+void              gegl_buffer_get_unlocked (GeglBuffer                *buffer,
+                                            gdouble                    scale,
+                                            const GeglBufferRectangle *rect,
+                                            const Babl                *format,
+                                            gpointer                   dest_buf,
+                                            gint                       rowstride,
+                                            GeglAbyssPolicy            repeat_mode);
+
+GeglBuffer *      gegl_buffer_new_ram     (const GeglBufferRectangle *extent,
+                                           const Babl                *format);
 
 void              gegl_buffer_emit_changed_signal (GeglBuffer *buffer,
-                                                   const GeglRectangle *rect);
+                                                   const GeglBufferRectangle *rect);
 
 /* the instance size of a GeglTile is a bit large, and should if possible be
  * trimmed down
@@ -196,8 +196,8 @@ gboolean gegl_tile_damage         (GeglTile *tile,
 
 void _gegl_buffer_drop_hot_tile (GeglBuffer *buffer);
 
-GeglRectangle _gegl_get_required_for_scale (const GeglRectangle *roi,
-                                            gdouble              scale);
+GeglBufferRectangle _gegl_get_required_for_scale (const GeglBufferRectangle *roi,
+                                                  gdouble                    scale);
 
 gboolean gegl_buffer_scan_compatible (GeglBuffer *bufferA,
                                       gint        xA,
@@ -207,9 +207,9 @@ gboolean gegl_buffer_scan_compatible (GeglBuffer *bufferA,
                                       gint        yB);
 
 
-extern void (*gegl_tile_handler_cache_ext_flush) (void *tile_handler_cache, const GeglRectangle *rect);
-extern void (*gegl_buffer_ext_flush) (GeglBuffer *buffer, const GeglRectangle *rect);
-extern void (*gegl_buffer_ext_invalidate) (GeglBuffer *buffer, const GeglRectangle *rect);
+extern void (*gegl_tile_handler_cache_ext_flush) (void *tile_handler_cache, const GeglBufferRectangle *rect);
+extern void (*gegl_buffer_ext_flush) (GeglBuffer *buffer, const GeglBufferRectangle *rect);
+extern void (*gegl_buffer_ext_invalidate) (GeglBuffer *buffer, const GeglBufferRectangle *rect);
 
 
 #ifndef __GEGL_TILE_H__
diff --git a/gegl/buffer/gegl-buffer-save.c b/gegl/buffer/gegl-buffer-save.c
index c39b9780d..257d9e1f6 100644
--- a/gegl/buffer/gegl-buffer-save.c
+++ b/gegl/buffer/gegl-buffer-save.c
@@ -188,9 +188,9 @@ gegl_buffer_header_init (GeglBufferHeader *header,
 }
 
 void
-gegl_buffer_save (GeglBuffer          *buffer,
-                  const gchar         *path,
-                  const GeglRectangle *roi)
+gegl_buffer_save (GeglBuffer                *buffer,
+                  const gchar               *path,
+                  const GeglBufferRectangle *roi)
 {
   SaveInfo *info = g_slice_new0 (SaveInfo);
 
diff --git a/gegl/buffer/gegl-buffer-types.h b/gegl/buffer/gegl-buffer-types.h
index 7bed29a52..ced2b53f8 100644
--- a/gegl/buffer/gegl-buffer-types.h
+++ b/gegl/buffer/gegl-buffer-types.h
@@ -30,20 +30,19 @@
 
 struct _GeglTileBackendPrivate
 {
-  gint                   tile_width;
-  gint                   tile_height;
-  const Babl            *format;    /* defaults to the babl format "R'G'B'A u8" */
-  gint                   px_size;   /* size of a single pixel in bytes */
-  gint                   tile_size; /* size of an entire tile in bytes */
+  gint                         tile_width;
+  gint                         tile_height;
+  const Babl                  *format;    /* defaults to the babl format "R'G'B'A u8" */
+  gint                         px_size;   /* size of a single pixel in bytes */
+  gint                         tile_size; /* size of an entire tile in bytes */
+  gboolean                     flush_on_destroy;
 
-  gboolean               flush_on_destroy;
+  GeglBufferRectangle          extent;
 
-  GeglRectangle          extent;
+  gpointer                     storage;
+  gboolean                     shared;
 
-  gpointer               storage;
-  gboolean               shared;
-
-  GeglTileSourceCommand  command;
+  GeglTileSourceCommand        command;
 };
 
 typedef struct _GeglTileHandlerChain      GeglTileHandlerChain;
diff --git a/gegl/buffer/gegl-buffer.c b/gegl/buffer/gegl-buffer.c
index f8a851c30..687c754a0 100644
--- a/gegl/buffer/gegl-buffer.c
+++ b/gegl/buffer/gegl-buffer.c
@@ -289,8 +289,8 @@ static volatile gint  de_allocated_buffers   = 0;
  * would be voided as a result of changing the extent.
  */
 gboolean
-gegl_buffer_set_extent (GeglBuffer          *buffer,
-                        const GeglRectangle *extent)
+gegl_buffer_set_extent (GeglBuffer                *buffer,
+                        const GeglBufferRectangle *extent)
 {
   g_return_val_if_fail (GEGL_IS_BUFFER (buffer), FALSE);
 
@@ -306,8 +306,8 @@ gegl_buffer_set_extent (GeglBuffer          *buffer,
 }
 
 gboolean
-gegl_buffer_set_abyss (GeglBuffer          *buffer,
-                       const GeglRectangle *abyss)
+gegl_buffer_set_abyss (GeglBuffer                *buffer,
+                       const GeglBufferRectangle *abyss)
 {
   g_return_val_if_fail (GEGL_IS_BUFFER (buffer), FALSE);
 
@@ -457,9 +457,9 @@ gegl_buffer_tile_storage (GeglBuffer *buffer)
 }
 
 static void
-gegl_buffer_storage_changed (GeglTileStorage     *storage,
-                             const GeglRectangle *rect,
-                             gpointer             userdata)
+gegl_buffer_storage_changed (GeglTileStorage           *storage,
+                             const GeglBufferRectangle *rect,
+                             gpointer                   userdata)
 {
   gegl_buffer_emit_changed_signal (GEGL_BUFFER (userdata), rect);
 }
@@ -652,9 +652,9 @@ gegl_buffer_constructor (GType                  type,
   if (GEGL_IS_BUFFER (source))
     {
       GeglBuffer *source_buf = GEGL_BUFFER (source);
-      GeglRectangle parent;
-      GeglRectangle request;
-      GeglRectangle self;
+      GeglBufferRectangle parent;
+      GeglBufferRectangle request;
+      GeglBufferRectangle self;
 
       parent.x = source_buf->abyss.x - buffer->shift_x;
       parent.y = source_buf->abyss.y - buffer->shift_y;
@@ -933,7 +933,7 @@ gegl_buffer_init (GeglBuffer *buffer)
 }
 
 
-const GeglRectangle *
+const GeglBufferRectangle *
 gegl_buffer_get_extent (GeglBuffer *buffer)
 {
   g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
@@ -941,7 +941,7 @@ gegl_buffer_get_extent (GeglBuffer *buffer)
   return &(buffer->extent);
 }
 
-const GeglRectangle *
+const GeglBufferRectangle *
 gegl_buffer_get_abyss (GeglBuffer *buffer)
 {
   g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
@@ -951,10 +951,10 @@ gegl_buffer_get_abyss (GeglBuffer *buffer)
 
 
 GeglBuffer *
-gegl_buffer_new_ram (const GeglRectangle *extent,
-                     const Babl          *format)
+gegl_buffer_new_ram (const GeglBufferRectangle *extent,
+                     const Babl                *format)
 {
-  GeglRectangle empty={0,0,0,0};
+  GeglBufferRectangle empty={0,0,0,0};
 
   if (extent == NULL)
     extent = &empty;
@@ -973,10 +973,10 @@ gegl_buffer_new_ram (const GeglRectangle *extent,
 }
 
 GeglBuffer *
-gegl_buffer_new (const GeglRectangle *extent,
-                 const Babl          *format)
+gegl_buffer_new (const GeglBufferRectangle *extent,
+                 const Babl                *format)
 {
-  GeglRectangle empty={0,0,0,0};
+  GeglBufferRectangle empty={0,0,0,0};
 
   if (extent == NULL)
     extent = &empty;
@@ -994,10 +994,10 @@ gegl_buffer_new (const GeglRectangle *extent,
 }
 
 GeglBuffer *
-gegl_buffer_new_for_backend (const GeglRectangle *extent,
-                             GeglTileBackend     *backend)
+gegl_buffer_new_for_backend (const GeglBufferRectangle *extent,
+                             GeglTileBackend           *backend)
 {
-  GeglRectangle rect = { 0, 0, 0, 0 };
+  GeglBufferRectangle rect = { 0, 0, 0, 0 };
   const Babl   *format;
 
   /* if no extent is passed in inherit from backend */
@@ -1042,8 +1042,8 @@ gegl_buffer_remove_handler (GeglBuffer *buffer,
  * on runtime, and recycling them through a hashtable?
  */
 GeglBuffer*
-gegl_buffer_create_sub_buffer (GeglBuffer          *buffer,
-                               const GeglRectangle *extent)
+gegl_buffer_create_sub_buffer (GeglBuffer                *buffer,
+                               const GeglBufferRectangle *extent)
 {
   g_return_val_if_fail (GEGL_IS_BUFFER (buffer), NULL);
 
@@ -1171,12 +1171,12 @@ gegl_buffer_unlock (GeglBuffer *buffer)
 #endif
 
 void
-gegl_buffer_emit_changed_signal (GeglBuffer          *buffer,
-                                 const GeglRectangle *rect)
+gegl_buffer_emit_changed_signal (GeglBuffer                *buffer,
+                                 const GeglBufferRectangle *rect)
 {
   if (buffer->changed_signal_connections)
   {
-    GeglRectangle copy;
+    GeglBufferRectangle copy;
 
     if (rect == NULL)
       copy = *gegl_buffer_get_extent (buffer);
@@ -1221,6 +1221,6 @@ gegl_buffer_get_tile (GeglBuffer *buffer,
   return tile;
 }
 
-void (*gegl_tile_handler_cache_ext_flush) (void *cache, const GeglRectangle *rect)=NULL;
-void (*gegl_buffer_ext_flush) (GeglBuffer *buffer, const GeglRectangle *rect)=NULL;
-void (*gegl_buffer_ext_invalidate) (GeglBuffer *buffer, const GeglRectangle *rect)=NULL;
+void (*gegl_tile_handler_cache_ext_flush) (void *cache, const GeglBufferRectangle *rect)=NULL;
+void (*gegl_buffer_ext_flush) (GeglBuffer *buffer, const GeglBufferRectangle *rect)=NULL;
+void (*gegl_buffer_ext_invalidate) (GeglBuffer *buffer, const GeglBufferRectangle *rect)=NULL;
diff --git a/gegl/buffer/gegl-buffer.h b/gegl/buffer/gegl-buffer.h
index b3352c8dc..a3e85c931 100644
--- a/gegl/buffer/gegl-buffer.h
+++ b/gegl/buffer/gegl-buffer.h
@@ -31,6 +31,36 @@ typedef struct _GeglTileBackend GeglTileBackend;
 typedef struct _GeglBuffer  GeglBuffer;
 typedef struct _GeglSampler       GeglSampler;
 
+typedef struct _GeglBufferRectangle GeglBufferRectangle;
+
+struct _GeglBufferRectangle
+{
+  gint x;
+  gint y;
+  gint width;
+  gint height;
+};
+
+#ifndef __cplusplus
+
+#define  GEGL_BUFFER_RECTANGLE(x,y,w,h) (&((GeglBufferRectangle){(x), (y),   (w), (h)}))
+
+#else
+
+static inline GeglBufferRectangle
+_gegl_buffer_rectangle_helper (gint x,
+                               gint y,
+                               gint width,
+                               gint height)
+{
+  GeglBufferRectangle result = {x, y, width, height};
+  return result;
+}
+
+#define  GEGL_BUFFER_RECTANGLE(x,y,w,h) \
+  ((GeglBufferRectangle *) &(const GeglBufferRectangle &) ::_gegl_buffer_rectangle_helper (x, y, w, h))
+
+#endif /* __cplusplus */
 
 
 
@@ -49,7 +79,7 @@ typedef struct _GeglSampler       GeglSampler;
 /**
  * gegl_buffer_new: (skip)
  * @extent: the geometry of the buffer (origin, width and height) a
- * GeglRectangle.
+ * GeglBufferRectangle.
  * @format: the Babl pixel format to be used, create one with babl_format("RGBA
  * u8") and similar.
  *
@@ -57,13 +87,13 @@ typedef struct _GeglSampler       GeglSampler;
  * possible to pass in NULL for both extent and format, a NULL extent creates
  * an empty buffer and a NULL format makes the buffer default to "RGBA float".
  */
-GeglBuffer *    gegl_buffer_new               (const GeglRectangle *extent,
-                                               const Babl          *format);
+GeglBuffer *    gegl_buffer_new               (const GeglBufferRectangle *extent,
+                                               const Babl                *format);
 
 /**
  * gegl_buffer_new_for_backend:
  * @extent: the geometry of the buffer (origin, width and height) a
- * GeglRectangle.
+ * GeglBufferRectangle.
  * @backend: an instance of a GeglTileBackend subclass.
  *
  * Create a new GeglBuffer from a backend, if NULL is passed in the extent of
@@ -71,7 +101,7 @@ GeglBuffer *    gegl_buffer_new               (const GeglRectangle *extent,
  *
  * returns a GeglBuffer, that holds a reference to the provided backend.
  */
-GeglBuffer *   gegl_buffer_new_for_backend    (const GeglRectangle *extent,
+GeglBuffer *   gegl_buffer_new_for_backend    (const GeglBufferRectangle *extent,
                                                GeglTileBackend     *backend);
 
 /**
@@ -115,9 +145,9 @@ GeglBuffer *    gegl_buffer_open              (const gchar         *path);
  *
  * Write a GeglBuffer to a file.
  */
-void            gegl_buffer_save              (GeglBuffer          *buffer,
-                                               const gchar         *path,
-                                               const GeglRectangle *roi);
+void            gegl_buffer_save              (GeglBuffer                *buffer,
+                                               const gchar               *path,
+                                               const GeglBufferRectangle *roi);
 
 /**
  * gegl_buffer_load:
@@ -150,18 +180,18 @@ void            gegl_buffer_flush             (GeglBuffer          *buffer);
  *
  * Return value: (transfer full): the new sub buffer
  */
-GeglBuffer *    gegl_buffer_create_sub_buffer (GeglBuffer          *buffer,
-                                               const GeglRectangle *extent);
+GeglBuffer *    gegl_buffer_create_sub_buffer (GeglBuffer                *buffer,
+                                               const GeglBufferRectangle *extent);
 
 /**
  * gegl_buffer_get_extent:
  * @buffer: the buffer to operate on.
  *
- * Returns a pointer to a GeglRectangle structure defining the geometry of a
+ * Returns a pointer to a GeglBufferRectangle structure defining the geometry of a
  * specific GeglBuffer, this is also the default width/height of buffers passed
  * in to gegl_buffer_set and gegl_buffer_get (with a scale of 1.0 at least).
  */
-const GeglRectangle * gegl_buffer_get_extent  (GeglBuffer *buffer);
+const GeglBufferRectangle * gegl_buffer_get_extent  (GeglBuffer *buffer);
 
 
 /**
@@ -175,8 +205,8 @@ const GeglRectangle * gegl_buffer_get_extent  (GeglBuffer *buffer);
  *
  * Returns TRUE if the change of extent was successful.
  */
-gboolean          gegl_buffer_set_extent      (GeglBuffer          *buffer,
-                                               const GeglRectangle *extent);
+gboolean          gegl_buffer_set_extent      (GeglBuffer               *buffer,
+                                               const GeglBufferRectangle *extent);
 
 /**
  * gegl_buffer_set_abyss:
@@ -187,8 +217,8 @@ gboolean          gegl_buffer_set_extent      (GeglBuffer          *buffer,
  *
  * Returns TRUE if the change of abyss was successful.
  */
-gboolean          gegl_buffer_set_abyss      (GeglBuffer          *buffer,
-                                              const GeglRectangle *abyss);
+gboolean          gegl_buffer_set_abyss      (GeglBuffer                *buffer,
+                                              const GeglBufferRectangle *abyss);
 
 /* convenience access macros */
 
@@ -260,13 +290,13 @@ gboolean          gegl_buffer_set_abyss      (GeglBuffer          *buffer,
  * the tile structure into a linear buffer.
  *
  */
-void            gegl_buffer_get               (GeglBuffer          *buffer,
-                                               const GeglRectangle *rect,
-                                               gdouble              scale,
-                                               const Babl          *format,
-                                               gpointer             dest,
-                                               gint                 rowstride,
-                                               GeglAbyssPolicy      repeat_mode);
+void            gegl_buffer_get               (GeglBuffer                *buffer,
+                                               const GeglBufferRectangle *rect,
+                                               gdouble                    scale,
+                                               const Babl                *format,
+                                               gpointer                   dest,
+                                               gint                       rowstride,
+                                               GeglAbyssPolicy            repeat_mode);
 
 /**
  * gegl_buffer_set: (skip)
@@ -283,12 +313,12 @@ void            gegl_buffer_get               (GeglBuffer          *buffer,
  *
  * Store a linear raster buffer into the GeglBuffer.
  */
-void            gegl_buffer_set               (GeglBuffer          *buffer,
-                                               const GeglRectangle *rect,
-                                               gint                 mipmap_level,
-                                               const Babl          *format,
-                                               const void          *src,
-                                               gint                 rowstride);
+void            gegl_buffer_set               (GeglBuffer                *buffer,
+                                               const GeglBufferRectangle *rect,
+                                               gint                       mipmap_level,
+                                               const Babl                *format,
+                                               const void                *src,
+                                               gint                       rowstride);
 
 
 /**
@@ -299,9 +329,9 @@ void            gegl_buffer_set               (GeglBuffer          *buffer,
  *
  * Sets the region covered by rect to the specified color.
  */
-void            gegl_buffer_set_color         (GeglBuffer          *buffer,
-                                               const GeglRectangle *rect,
-                                               GeglColor           *color);
+void            gegl_buffer_set_color         (GeglBuffer                *buffer,
+                                               const GeglBufferRectangle *rect,
+                                               GeglColor                 *color);
 
 
 /**
@@ -314,10 +344,10 @@ void            gegl_buffer_set_color         (GeglBuffer          *buffer,
  * Sets the region covered by rect to the the provided pixel.
  */
 void
-gegl_buffer_set_color_from_pixel (GeglBuffer          *buffer,
-                                  const GeglRectangle *rect,
-                                  const guchar        *pixel,
-                                  const Babl          *pixel_format);
+gegl_buffer_set_color_from_pixel (GeglBuffer                *buffer,
+                                  const GeglBufferRectangle *rect,
+                                  const guchar              *pixel,
+                                  const Babl                *pixel_format);
 
 
 /**
@@ -332,11 +362,11 @@ gegl_buffer_set_color_from_pixel (GeglBuffer          *buffer,
  * relative to the origin (0, 0) and not to the rectangle. So be carefull
  * about the origin of @pattern and @buffer extents.
  */
-void            gegl_buffer_set_pattern       (GeglBuffer          *buffer,
-                                               const GeglRectangle *rect,
-                                               GeglBuffer          *pattern,
-                                               gint                 x_offset,
-                                               gint                 y_offset);
+void            gegl_buffer_set_pattern       (GeglBuffer                *buffer,
+                                               const GeglBufferRectangle *rect,
+                                               GeglBuffer                *pattern,
+                                               gint                       x_offset,
+                                               gint                       y_offset);
 
 /**
  * gegl_buffer_get_format: (skip)
@@ -377,8 +407,8 @@ const Babl *    gegl_buffer_set_format        (GeglBuffer          *buffer,
  * Clears the provided rectangular region by setting all the associated memory
  * to 0.
  */
-void            gegl_buffer_clear             (GeglBuffer          *buffer,
-                                               const GeglRectangle *roi);
+void            gegl_buffer_clear             (GeglBuffer                *buffer,
+                                               const GeglBufferRectangle *roi);
 
 
 /**
@@ -398,11 +428,11 @@ void            gegl_buffer_clear             (GeglBuffer          *buffer,
  * This function never does any scaling. When src_rect and dst_rect do not have
  * the same width and height, the size of src_rect is used.
  */
-void            gegl_buffer_copy              (GeglBuffer          *src,
-                                               const GeglRectangle *src_rect,
-                                               GeglAbyssPolicy      repeat_mode,
-                                               GeglBuffer          *dst,
-                                               const GeglRectangle *dst_rect);
+void            gegl_buffer_copy              (GeglBuffer                *src,
+                                               const GeglBufferRectangle *src_rect,
+                                               GeglAbyssPolicy            repeat_mode,
+                                               GeglBuffer                *dst,
+                                               const GeglBufferRectangle *dst_rect);
 
 
 
@@ -619,7 +649,7 @@ void              gegl_sampler_get            (GeglSampler    *sampler,
  *
  * Returns:The context rectangle of the given @sampler.
  */
-const GeglRectangle * gegl_sampler_get_context_rect (GeglSampler *sampler);
+const GeglBufferRectangle * gegl_sampler_get_context_rect (GeglSampler *sampler);
 
 /**
  * gegl_buffer_linear_new: (skip)
@@ -632,8 +662,8 @@ const GeglRectangle * gegl_sampler_get_context_rect (GeglSampler *sampler);
  *
  * Returns: a GeglBuffer that can be used as any other GeglBuffer.
  */
-GeglBuffer *  gegl_buffer_linear_new          (const GeglRectangle *extent,
-                                               const Babl          *format);
+GeglBuffer *  gegl_buffer_linear_new          (const GeglBufferRectangle *extent,
+                                               const Babl                *format);
 
 /**
  * gegl_buffer_linear_new_from_data: (skip)
@@ -653,12 +683,12 @@ GeglBuffer *  gegl_buffer_linear_new          (const GeglRectangle *extent,
  *
  * Returns: a GeglBuffer that can be used as any other GeglBuffer.
  */
-GeglBuffer * gegl_buffer_linear_new_from_data (const gpointer       data,
-                                               const Babl          *format,
-                                               const GeglRectangle *extent,
-                                               gint                 rowstride,
-                                               GDestroyNotify       destroy_fn,
-                                               gpointer             destroy_fn_data);
+GeglBuffer * gegl_buffer_linear_new_from_data (const gpointer             data,
+                                               const Babl                *format,
+                                               const GeglBufferRectangle *extent,
+                                               gint                       rowstride,
+                                               GDestroyNotify             destroy_fn,
+                                               gpointer                   destroy_fn_data);
 
 /**
  * gegl_buffer_linear_open: (skip)
@@ -673,10 +703,10 @@ GeglBuffer * gegl_buffer_linear_new_from_data (const gpointer       data,
  * request is compatible with the underlying data storage direct access
  * to the underlying data is provided. Otherwise, it returns a copy of the data.
  */
-gpointer        gegl_buffer_linear_open       (GeglBuffer          *buffer,
-                                               const GeglRectangle *extent,
-                                               gint                *rowstride,
-                                               const Babl          *format);
+gpointer        gegl_buffer_linear_open       (GeglBuffer                *buffer,
+                                               const GeglBufferRectangle *extent,
+                                               gint                      *rowstride,
+                                               const Babl                *format);
 
 /**
  * gegl_buffer_linear_close:
@@ -699,7 +729,7 @@ void            gegl_buffer_linear_close      (GeglBuffer    *buffer,
  * Return the abyss extent of a buffer, this expands out to the parents extent in
  * subbuffers.
  */
-const GeglRectangle * gegl_buffer_get_abyss   (GeglBuffer           *buffer);
+const GeglBufferRectangle * gegl_buffer_get_abyss   (GeglBuffer           *buffer);
 
 
 
@@ -735,7 +765,7 @@ glong gegl_buffer_signal_connect (GeglBuffer *buffer,
  * threads having an implicit synchronization of its own.
  */
 void
-gegl_buffer_flush_ext (GeglBuffer *buffer, const GeglRectangle *rect);
+gegl_buffer_flush_ext (GeglBuffer *buffer, const GeglBufferRectangle *rect);
 
 #include <gegl-buffer-iterator.h>
 
@@ -748,5 +778,9 @@ GType gegl_buffer_get_type  (void) G_GNUC_CONST;
 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GeglBuffer, g_object_unref)
 
 
+
+
+
+
 G_END_DECLS
 #endif
diff --git a/gegl/buffer/gegl-sampler-nearest.c b/gegl/buffer/gegl-sampler-nearest.c
index 6444fe990..b3d3261d7 100644
--- a/gegl/buffer/gegl-sampler-nearest.c
+++ b/gegl/buffer/gegl-sampler-nearest.c
@@ -100,7 +100,7 @@ gegl_sampler_get_pixel (GeglSampler    *sampler,
 {
   GeglSamplerNearest *nearest_sampler = (GeglSamplerNearest*)(sampler);
   GeglBuffer *buffer = sampler->buffer;
-  const GeglRectangle *abyss = &buffer->abyss;
+  const GeglBufferRectangle *abyss = &buffer->abyss;
   guchar              *buf   = data;
 
   if (y <  abyss->y ||
diff --git a/gegl/buffer/gegl-sampler.c b/gegl/buffer/gegl-sampler.c
index c6bb32101..e017eb6bd 100644
--- a/gegl/buffer/gegl-sampler.c
+++ b/gegl/buffer/gegl-sampler.c
@@ -68,9 +68,9 @@ static void set_property            (GObject             *gobject,
 static void set_buffer              (GeglSampler         *self,
                                      GeglBuffer          *buffer);
 
-static void buffer_contents_changed (GeglBuffer          *buffer,
-                                     const GeglRectangle *changed_rect,
-                                     gpointer             userdata);
+static void buffer_contents_changed (GeglBuffer                *buffer,
+                                     const GeglBufferRectangle *changed_rect,
+                                     gpointer                   userdata);
 
 static void constructed (GObject *sampler);
 
@@ -127,8 +127,8 @@ gegl_sampler_init (GeglSampler *sampler)
   gint i = 0;
   sampler->buffer = NULL;
   do {
-    GeglRectangle context_rect      = {0,0,1,1};
-    GeglRectangle sampler_rectangle = {0,0,0,0};
+    GeglBufferRectangle context_rect      = {0,0,1,1};
+    GeglBufferRectangle sampler_rectangle = {0,0,0,0};
     sampler->level[i].sampler_buffer = NULL;
     sampler->level[i].context_rect   = context_rect;
     sampler->level[i].sampler_rectangle = sampler_rectangle;
@@ -163,14 +163,14 @@ gegl_sampler_get (GeglSampler     *self,
   if (self->lvel)
   {
     double factor = 1.0 / (1 << self->lvel);
-    GeglRectangle rect={floorf (x * factor), floorf (y * factor),1,1};
+    GeglBufferRectangle rect={floorf (x * factor), floorf (y * factor),1,1};
     gegl_buffer_get (self->buffer, &rect, factor, self->format, output, GEGL_AUTO_ROWSTRIDE, repeat_mode);
     return;
   }
 
   if (gegl_buffer_ext_flush)
     {
-      GeglRectangle rect={x,y,1,1};
+      GeglBufferRectangle rect={x,y,1,1};
       gegl_buffer_ext_flush (self->buffer, &rect);
     }
   self->get (self, x, y, scale, output, repeat_mode);
@@ -269,7 +269,7 @@ gegl_sampler_get_from_mipmap (GeglSampler    *sampler,
 
   if (gegl_buffer_ext_flush)
     {
-      GeglRectangle rect = {x, y, 1, 1};
+      GeglBufferRectangle rect = {x, y, 1, 1};
       gegl_buffer_ext_flush (sampler->buffer, &rect);
     }
 
@@ -431,7 +431,7 @@ _gegl_buffer_sample_at_level (GeglBuffer       *buffer,
   if (sampler_type == GEGL_SAMPLER_NEAREST &&
       level == 0)
     {
-      GeglRectangle rect = {x, y, 1, 1};
+      GeglBufferRectangle rect = {x, y, 1, 1};
       gegl_buffer_get (buffer, &rect, 1.0,
                        format, dest, GEGL_AUTO_ROWSTRIDE,
                        repeat_mode);
@@ -521,16 +521,16 @@ gegl_buffer_sampler_new (GeglBuffer      *buffer,
 }
 
 
-const GeglRectangle*
+const GeglBufferRectangle*
 gegl_sampler_get_context_rect (GeglSampler *sampler)
 {
   return &(sampler->level[0].context_rect);
 }
 
 static void
-buffer_contents_changed (GeglBuffer          *buffer,
-                         const GeglRectangle *changed_rect,
-                         gpointer             userdata)
+buffer_contents_changed (GeglBuffer                *buffer,
+                         const GeglBufferRectangle *changed_rect,
+                         gpointer                   userdata)
 {
   GeglSampler *self = GEGL_SAMPLER (userdata);
   int i;
diff --git a/gegl/buffer/gegl-sampler.h b/gegl/buffer/gegl-sampler.h
index 83b469a3a..667b3a57d 100644
--- a/gegl/buffer/gegl-sampler.h
+++ b/gegl/buffer/gegl-sampler.h
@@ -50,13 +50,13 @@ typedef struct _GeglSamplerClass GeglSamplerClass;
 
 typedef struct GeglSamplerLevel
 {
-  GeglRectangle  context_rect;
-  gpointer       sampler_buffer;
-  GeglRectangle  sampler_rectangle;
-  gint           last_x;
-  gint           last_y;
-  float          delta_x;
-  float          delta_y;
+  GeglBufferRectangle  context_rect;
+  gpointer             sampler_buffer;
+  GeglBufferRectangle  sampler_rectangle;
+  gint                 last_x;
+  gint                 last_y;
+  float                delta_x;
+  float                delta_y;
 } GeglSamplerLevel;
 
 struct _GeglSampler
@@ -107,13 +107,13 @@ gfloat * _gegl_sampler_get_ptr        (GeglSampler     *sampler,
                                        gint             y,
                                        GeglAbyssPolicy  repeat_mode);
 
-static inline GeglRectangle _gegl_sampler_compute_rectangle (
+static inline GeglBufferRectangle _gegl_sampler_compute_rectangle (
                                       GeglSampler *sampler,
                                       gint         x,
                                       gint         y,
                                       gint         level_no)
 {
-  GeglRectangle rectangle;
+  GeglBufferRectangle rectangle;
   GeglSamplerLevel *level = &sampler->level[level_no];
 
   rectangle.width  = level->context_rect.width + 2;
diff --git a/gegl/buffer/gegl-tile-backend-buffer.c b/gegl/buffer/gegl-tile-backend-buffer.c
index 2a8f67e43..0f64221be 100644
--- a/gegl/buffer/gegl-tile-backend-buffer.c
+++ b/gegl/buffer/gegl-tile-backend-buffer.c
@@ -304,7 +304,7 @@ gegl_tile_backend_buffer_emit_changed_signal (GeglTileBackendBuffer *tile_backen
 
   if (buffer->changed_signal_connections)
     {
-      GeglRectangle rect;
+      GeglBufferRectangle rect;
 
       rect.width  = buffer->tile_width  >> z;
       rect.height = buffer->tile_height >> z;
diff --git a/gegl/buffer/gegl-tile-backend-file-async.c b/gegl/buffer/gegl-tile-backend-file-async.c
index 82d1a4bf1..ae3f06d46 100644
--- a/gegl/buffer/gegl-tile-backend-file-async.c
+++ b/gegl/buffer/gegl-tile-backend-file-async.c
@@ -523,7 +523,7 @@ gegl_tile_backend_file_write_header (GeglTileBackendFile *self)
 {
   GeglFileBackendThreadParams *params = g_new0 (GeglFileBackendThreadParams, 1);
   guchar *new_source = g_malloc (256);
-  GeglRectangle roi = gegl_tile_backend_get_extent ((GeglTileBackend *)self);
+  GeglBufferRectangle roi = gegl_tile_backend_get_extent ((GeglTileBackend *)self);
 
   gegl_tile_backend_file_ensure_exist (self);
 
@@ -1088,7 +1088,7 @@ gegl_tile_backend_file_load_index (GeglTileBackendFile *self,
             {
               GeglTileStorage *storage =
                 (void*)gegl_tile_backend_peek_storage (backend);
-              GeglRectangle rect;
+              GeglBufferRectangle rect;
               g_hash_table_remove (self->index, existing);
 
               gegl_tile_source_refetch (GEGL_TILE_SOURCE (storage),
@@ -1193,7 +1193,7 @@ gegl_tile_backend_file_constructed (GObject *object)
       backend->priv->tile_size   = backend->priv->tile_width *
                                     backend->priv->tile_height *
                                     backend->priv->px_size;
-      backend->priv->extent      = (GeglRectangle) {self->header.x,
+      backend->priv->extent      = (GeglBufferRectangle) {self->header.x,
                                                     self->header.y,
                                                     self->header.width,
                                                     self->header.height};
diff --git a/gegl/buffer/gegl-tile-backend.c b/gegl/buffer/gegl-tile-backend.c
index 03e5021a8..958b84c32 100644
--- a/gegl/buffer/gegl-tile-backend.c
+++ b/gegl/buffer/gegl-tile-backend.c
@@ -295,13 +295,13 @@ gegl_tile_backend_get_format (GeglTileBackend *tile_backend)
 
 
 void
-gegl_tile_backend_set_extent (GeglTileBackend     *tile_backend,
-                              const GeglRectangle *rectangle)
+gegl_tile_backend_set_extent (GeglTileBackend           *tile_backend,
+                              const GeglBufferRectangle *rectangle)
 {
   tile_backend->priv->extent = *rectangle;
 }
 
-GeglRectangle
+GeglBufferRectangle
 gegl_tile_backend_get_extent (GeglTileBackend *tile_backend)
 {
   return tile_backend->priv->extent;
diff --git a/gegl/buffer/gegl-tile-backend.h b/gegl/buffer/gegl-tile-backend.h
index 3d1f806a2..03070c14f 100644
--- a/gegl/buffer/gegl-tile-backend.h
+++ b/gegl/buffer/gegl-tile-backend.h
@@ -103,10 +103,14 @@ GeglTileSource *gegl_tile_backend_peek_storage  (GeglTileBackend *tile_backend);
  * backend with the width/height information when constructing proxy
  * GeglBuffers to interact with other systems
  */
-void  gegl_tile_backend_set_extent    (GeglTileBackend     *tile_backend,
-                                       const GeglRectangle *rectangle);
+void  gegl_tile_backend_set_extent    (GeglTileBackend           *tile_backend,
+                                       const GeglBufferRectangle *rectangle);
 
-GeglRectangle gegl_tile_backend_get_extent (GeglTileBackend *tile_backend);
+/**
+ * gegl_tile_backend_get_extent: (skip)
+ * @tile_backend: a #GeglTileBackend
+ */
+GeglBufferRectangle gegl_tile_backend_get_extent (GeglTileBackend *tile_backend);
 
 /**
  * gegl_tile_backend_set_flush_on_destroy:
diff --git a/gegl/buffer/gegl-tile-handler.c b/gegl/buffer/gegl-tile-handler.c
index 86318b869..c61f245e8 100644
--- a/gegl/buffer/gegl-tile-handler.c
+++ b/gegl/buffer/gegl-tile-handler.c
@@ -223,8 +223,8 @@ gegl_tile_handler_dup_tile (GeglTileHandler *handler,
 }
 
 void
-gegl_tile_handler_damage_rect (GeglTileHandler     *handler,
-                               const GeglRectangle *rect)
+gegl_tile_handler_damage_rect (GeglTileHandler           *handler,
+                               const GeglBufferRectangle *rect)
 {
   GeglTileSource *source;
   gint            tile_width;
diff --git a/gegl/buffer/gegl-tile-handler.h b/gegl/buffer/gegl-tile-handler.h
index 72e77a05e..7f0029631 100644
--- a/gegl/buffer/gegl-tile-handler.h
+++ b/gegl/buffer/gegl-tile-handler.h
@@ -101,8 +101,8 @@ GeglTile * gegl_tile_handler_dup_tile    (GeglTileHandler *handler,
                                           gint             y,
                                           gint             z);
 
-void       gegl_tile_handler_damage_rect (GeglTileHandler     *handler,
-                                          const GeglRectangle *rect);
+void       gegl_tile_handler_damage_rect (GeglTileHandler           *handler,
+                                          const GeglBufferRectangle *rect);
 
 G_END_DECLS
 
diff --git a/gegl/gegl-types.h b/gegl/gegl-types.h
index 7315d4cdc..7d9c2ed43 100644
--- a/gegl/gegl-types.h
+++ b/gegl/gegl-types.h
@@ -61,45 +61,13 @@ GType gegl_stats_get_type (void) G_GNUC_CONST;
 #define GEGL_STATS(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEGL_TYPE_STATS, GeglStats))
 #define GEGL_IS_STATS(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEGL_TYPE_STATS))
 
+
+
 typedef struct _GeglCurve         GeglCurve;
 typedef struct _GeglPath          GeglPath;
 typedef struct _GeglColor         GeglColor;
 typedef struct _GeglAudioFragment GeglAudioFragment;
 
-typedef struct _GeglRectangle GeglRectangle;
-
-struct _GeglRectangle
-{
-  gint x;
-  gint y;
-  gint width;
-  gint height;
-};
-GType gegl_rectangle_get_type (void) G_GNUC_CONST;
-#define GEGL_TYPE_RECTANGLE   (gegl_rectangle_get_type())
-
-#ifndef __cplusplus
-
-#define  GEGL_RECTANGLE(x,y,w,h) (&((GeglRectangle){(x), (y),   (w), (h)}))
-
-#else
-
-static inline GeglRectangle
-_gegl_rectangle_helper (gint x,
-                        gint y,
-                        gint width,
-                        gint height)
-{
-  GeglRectangle result = {x, y, width, height};
-
-  return result;
-}
-
-#define  GEGL_RECTANGLE(x,y,w,h) \
-  ((GeglRectangle *) &(const GeglRectangle &) ::_gegl_rectangle_helper (x, y, w, h))
-
-#endif /* __cplusplus */
-
 typedef struct _GeglOperationContext GeglOperationContext;
 
 typedef struct _GeglOperation  GeglOperation;
@@ -129,6 +97,34 @@ GType gegl_random_get_type  (void) G_GNUC_CONST;
 
 #include <gegl-buffer.h>
 
+typedef struct _GeglBufferRectangle     GeglRectangle;
+
+GType gegl_rectangle_get_type (void) G_GNUC_CONST;
+#define GEGL_TYPE_RECTANGLE   (gegl_rectangle_get_type())
+
+#ifndef __cplusplus
+
+#define  GEGL_RECTANGLE(x,y,w,h) (&((GeglRectangle){(x), (y),   (w), (h)}))
+
+#else
+
+static inline GeglRectangle
+_gegl_rectangle_helper (gint x,
+                        gint y,
+                        gint width,
+                        gint height)
+{
+  GeglRectangle result = {x, y, width, height};
+
+  return result;
+}
+
+#define  GEGL_RECTANGLE(x,y,w,h) \
+  ((GeglRectangle *) &(const GeglRectangle &) ::_gegl_rectangle_helper (x, y, w, h))
+
+#endif /* __cplusplus */
+
+
 G_END_DECLS
 
 #endif /* __GEGL_TYPES_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]