Index: app/core/gimp.c
===================================================================
--- app/core/gimp.c	(revision 27945)
+++ app/core/gimp.c	(working copy)
@@ -28,6 +28,8 @@
 
 #include "config/gimprc.h"
 
+#include "gegl/gimpgeglimage.h"
+
 #include "pdb/gimppdb.h"
 #include "pdb/gimp-pdb-compat.h"
 #include "pdb/internal-procs.h"
@@ -649,6 +651,11 @@ gimp_real_restore (Gimp               *g
   gimp_plug_in_manager_restore (gimp->plug_in_manager,
                                 gimp_get_user_context (gimp), status_callback);
 
+  /* Must run after gimp_plug_in_manager_restore() so that the
+   * plug-ins can be overriddenn
+   */
+  gimp_gegl_register_file_loaders (gimp);
+
   gimp->restored = TRUE;
 }
 
Index: app/core/gimpdrawable-preview.c
===================================================================
--- app/core/gimpdrawable-preview.c	(revision 27945)
+++ app/core/gimpdrawable-preview.c	(working copy)
@@ -171,6 +171,10 @@ gimp_drawable_preview_private (GimpDrawa
 {
   TempBuf *ret_buf;
 
+  /* TODO: Implement */
+  if (gimp_drawable_uses_gegl (drawable))
+    return NULL;
+
   if (! drawable->preview_valid ||
       ! (ret_buf = gimp_preview_cache_get (&drawable->preview_cache,
                                            width, height)))
Index: app/core/gimpdrawable-shadow.c
===================================================================
--- app/core/gimpdrawable-shadow.c	(revision 27945)
+++ app/core/gimpdrawable-shadow.c	(working copy)
@@ -101,3 +101,48 @@ gimp_drawable_merge_shadow_tiles (GimpDr
       tile_manager_unref (tiles);
     }
 }
+
+GeglBuffer *
+gimp_drawable_get_shadow_buffer (GimpDrawable *drawable)
+{
+  GimpItem     *item = NULL;
+  GeglRectangle rect = { 0, };
+
+  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
+
+  item = GIMP_ITEM (drawable);
+
+  if (drawable->shadow_buffer)
+    {
+      if ((gimp_item_get_width  (item) != gegl_buffer_get_extent (drawable->shadow_buffer)->width) ||
+          (gimp_item_get_height (item) != gegl_buffer_get_extent (drawable->shadow_buffer)->height))
+        {
+          gimp_drawable_free_shadow_buffer (drawable);
+        }
+      else
+        {
+          return drawable->shadow_buffer;
+        }
+    }
+
+  rect.width = gimp_item_get_width (item);
+  rect.height = gimp_item_get_height (item);
+
+  drawable->shadow_buffer =
+    gegl_buffer_new (&rect,
+                     babl_format ("RGBA u16"));
+
+  return drawable->shadow_buffer;
+}
+
+void
+gimp_drawable_free_shadow_buffer (GimpDrawable *drawable)
+{
+  g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+
+  if (drawable->shadow_buffer)
+    {
+      g_object_unref (drawable->shadow_buffer);
+      drawable->shadow_buffer = NULL;
+    }
+}
Index: app/core/gimpdrawable-shadow.h
===================================================================
--- app/core/gimpdrawable-shadow.h	(revision 27945)
+++ app/core/gimpdrawable-shadow.h	(working copy)
@@ -28,5 +28,8 @@ void          gimp_drawable_merge_shadow
                                                 gboolean      push_undo,
                                                 const gchar  *undo_desc);
 
+GeglBuffer *  gimp_drawable_get_shadow_buffer (GimpDrawable *drawable);
+void          gimp_drawable_free_shadow_buffer (GimpDrawable *drawable);
+
 
 #endif /* __GIMP_DRAWABLE_SHADOW_H__ */
Index: app/core/gimpdrawable.c
===================================================================
--- app/core/gimpdrawable.c	(revision 27945)
+++ app/core/gimpdrawable.c	(working copy)
@@ -132,6 +132,18 @@ static void       gimp_drawable_real_set
                                                     GimpImageType      type,
                                                     gint               offset_x,
                                                     gint               offset_y);
+static GeglBuffer * gimp_drawable_real_get_buffer
+                                                   (GimpDrawable      *drawable);
+static void         gimp_drawable_configure_internal
+                                                   (GimpDrawable      *drawable,
+                                                    GimpImage         *image,
+                                                    gint               offset_x,
+                                                    gint               offset_y,
+                                                    gint               width,
+                                                    gint               height,
+                                                    GimpImageType      type,
+                                                    const Babl        *format,
+                                                    const gchar       *name);
 static GeglNode * gimp_drawable_get_node           (GimpItem          *item);
 
 static void       gimp_drawable_real_push_undo     (GimpDrawable      *drawable,
@@ -217,6 +229,7 @@ gimp_drawable_class_init (GimpDrawableCl
   klass->replace_region              = gimp_drawable_real_replace_region;
   klass->get_tiles                   = gimp_drawable_real_get_tiles;
   klass->set_tiles                   = gimp_drawable_real_set_tiles;
+  klass->get_buffer                  = gimp_drawable_real_get_buffer;
   klass->push_undo                   = gimp_drawable_real_push_undo;
   klass->swap_pixels                 = gimp_drawable_real_swap_pixels;
 }
@@ -226,9 +239,12 @@ gimp_drawable_init (GimpDrawable *drawab
 {
   drawable->tiles         = NULL;
   drawable->shadow        = NULL;
+  drawable->buffer        = NULL;
+  drawable->shadow_buffer = NULL;
   drawable->bytes         = 0;
   drawable->type          = -1;
   drawable->has_alpha     = FALSE;
+  drawable->format        = NULL;
   drawable->preview_cache = NULL;
   drawable->preview_valid = FALSE;
 }
@@ -750,9 +766,16 @@ gimp_drawable_real_set_tiles (GimpDrawab
   if (drawable->source_node)
     gegl_node_set (drawable->source_node,
                    "tile-manager", drawable->tiles,
+                   "buffer",       drawable->buffer,
                    NULL);
 }
 
+static GeglBuffer *
+gimp_drawable_real_get_buffer (GimpDrawable *drawable)
+{
+  return drawable->buffer;
+}
+
 static GeglNode *
 gimp_drawable_get_node (GimpItem *item)
 {
@@ -902,6 +925,49 @@ gimp_drawable_configure (GimpDrawable  *
                          GimpImageType  type,
                          const gchar   *name)
 {
+  gimp_drawable_configure_internal (drawable,
+                                    image,
+                                    offset_x,
+                                    offset_y,
+                                    width,
+                                    height,
+                                    type,
+                                    NULL,
+                                    name);
+}
+
+void
+gimp_drawable_gegl_configure (GimpDrawable  *drawable,
+                              GimpImage     *image,
+                              gint           offset_x,
+                              gint           offset_y,
+                              gint           width,
+                              gint           height,
+                              const Babl    *format,
+                              const gchar   *name)
+{
+  gimp_drawable_configure_internal (drawable,
+                                    image,
+                                    offset_x,
+                                    offset_y,
+                                    width,
+                                    height,
+                                    (GimpImageType)-1,
+                                    format,
+                                    name);
+}
+
+static void
+gimp_drawable_configure_internal (GimpDrawable  *drawable,
+                                  GimpImage     *image,
+                                  gint           offset_x,
+                                  gint           offset_y,
+                                  gint           width,
+                                  gint           height,
+                                  GimpImageType  type,
+                                  const Babl    *format,
+                                  const gchar   *name)
+{
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
   g_return_if_fail (GIMP_IS_IMAGE (image));
   g_return_if_fail (width > 0 && height > 0);
@@ -909,14 +975,28 @@ gimp_drawable_configure (GimpDrawable  *
   gimp_item_configure (GIMP_ITEM (drawable), image,
                        offset_x, offset_y, width, height, name);
 
-  drawable->type      = type;
-  drawable->bytes     = GIMP_IMAGE_TYPE_BYTES (type);
-  drawable->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type);
+  drawable->type   = type;
+  drawable->format = format;
 
   if (drawable->tiles)
     tile_manager_unref (drawable->tiles);
+  drawable->tiles         = NULL;
+
+  if (drawable->buffer)
+    g_object_unref (drawable->buffer);
+  drawable->buffer   = NULL;
 
-  drawable->tiles = tile_manager_new (width, height, drawable->bytes);
+  if (format != NULL)
+    {
+      GeglRectangle extent = { offset_x, offset_y, width, height };
+      drawable->buffer = gegl_buffer_new (&extent, format);
+    }
+  else
+    {
+      drawable->bytes     = GIMP_IMAGE_TYPE_BYTES (type);
+      drawable->has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type);
+      drawable->tiles     = tile_manager_new (width, height, drawable->bytes);
+    }
 
   /*  preview variables  */
   drawable->preview_cache = NULL;
@@ -925,6 +1005,7 @@ gimp_drawable_configure (GimpDrawable  *
   if (drawable->source_node)
     gegl_node_set (drawable->source_node,
                    "tile-manager", drawable->tiles,
+                   "buffer",       drawable->buffer,
                    NULL);
 }
 
@@ -942,6 +1023,16 @@ gimp_drawable_update (GimpDrawable *draw
 }
 
 void
+gimp_drawable_update_extent (GimpDrawable        *drawable,
+                             const GeglRectangle *extent)
+{
+  g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+
+  g_signal_emit (drawable, gimp_drawable_signals[UPDATE], 0,
+                 extent->x, extent->y, extent->width, extent->height);
+}
+
+void
 gimp_drawable_alpha_changed (GimpDrawable *drawable)
 {
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
@@ -1177,6 +1268,14 @@ gimp_drawable_set_tiles (GimpDrawable  *
                                 offset_x, offset_y);
 }
 
+GeglBuffer *
+gimp_drawable_get_buffer (GimpDrawable *drawable)
+{
+  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
+
+  return GIMP_DRAWABLE_GET_CLASS (drawable)->get_buffer (drawable);
+}
+
 void
 gimp_drawable_set_tiles_full (GimpDrawable       *drawable,
                               gboolean            push_undo,
@@ -1234,6 +1333,7 @@ gimp_drawable_get_source_node (GimpDrawa
                                         NULL);
   gegl_node_set (drawable->source_node,
                  "tile-manager", drawable->tiles,
+                 "buffer",       drawable->buffer,
                  "linear",       TRUE,
                  NULL);
 
@@ -1567,7 +1667,8 @@ gimp_drawable_is_rgb (const GimpDrawable
 {
   g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
 
-  return GIMP_IMAGE_TYPE_IS_RGB (gimp_drawable_type (drawable));
+  return (GIMP_IMAGE_TYPE_IS_RGB (gimp_drawable_type (drawable)) ||
+          drawable->format == babl_format ("RGBA u16"));
 }
 
 gboolean
@@ -1619,6 +1720,14 @@ gimp_drawable_bytes_without_alpha (const
 }
 
 gboolean
+gimp_drawable_uses_gegl (const GimpDrawable *drawable)
+{
+  g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
+
+  return drawable->format != NULL;
+}
+
+gboolean
 gimp_drawable_has_floating_sel (const GimpDrawable *drawable)
 {
   GimpImage *image;
Index: app/core/gimpdrawable.h
===================================================================
--- app/core/gimpdrawable.h	(revision 27945)
+++ app/core/gimpdrawable.h	(working copy)
@@ -39,6 +39,10 @@ struct _GimpDrawable
   TileManager   *tiles;              /* tiles for drawable data        */
   TileManager   *shadow;             /* shadow buffer tiles            */
 
+  GeglBuffer    *buffer;             /* drawable data, will eventually
+                                        completely replace 'tiles'     */
+  GeglBuffer    *shadow_buffer;
+
   GeglNode      *source_node;
 
   GeglNode      *mode_node;
@@ -47,6 +51,8 @@ struct _GimpDrawable
   GimpImageType  type;               /* type of drawable               */
   gboolean       has_alpha;          /* drawable has alpha             */
 
+  const Babl    *format;             /* babl format of drawable        */
+
   /*  Preview variables  */
   GSList        *preview_cache;      /* preview caches of the channel  */
   gboolean       preview_valid;      /* is the preview valid?          */
@@ -104,6 +110,7 @@ struct _GimpDrawableClass
                                            GimpImageType         type,
                                            gint                  offset_x,
                                            gint                  offset_y);
+  GeglBuffer *  (* get_buffer)            (GimpDrawable         *drawable);
   void          (* push_undo)             (GimpDrawable         *drawable,
                                            const gchar          *undo_desc,
                                            TileManager          *tiles,
@@ -136,12 +143,23 @@ void            gimp_drawable_configure 
                                                   gint                height,
                                                   GimpImageType       type,
                                                   const gchar        *name);
+void            gimp_drawable_gegl_configure     (GimpDrawable       *drawable,
+                                                  GimpImage          *image,
+                                                  gint                offset_x,
+                                                  gint                offset_y,
+                                                  gint                width,
+                                                  gint                height,
+                                                  const Babl         *format,
+                                                  const gchar        *name);
 
 void            gimp_drawable_update             (GimpDrawable       *drawable,
                                                   gint                x,
                                                   gint                y,
                                                   gint                width,
                                                   gint                height);
+void            gimp_drawable_update_extent      (GimpDrawable        *drawable,
+                                                  const GeglRectangle *extent);
+
 void            gimp_drawable_alpha_changed      (GimpDrawable       *drawable);
 
 void           gimp_drawable_invalidate_boundary (GimpDrawable       *drawable);
@@ -187,6 +205,7 @@ void            gimp_drawable_set_tiles 
                                                   const gchar        *undo_desc,
                                                   TileManager        *tiles,
                                                   GimpImageType       type);
+GeglBuffer    * gimp_drawable_get_buffer         (GimpDrawable       *drawable);
 void            gimp_drawable_set_tiles_full     (GimpDrawable       *drawable,
                                                   gboolean            push_undo,
                                                   const gchar        *undo_desc,
@@ -243,6 +262,7 @@ gboolean        gimp_drawable_is_indexed
 gint            gimp_drawable_bytes              (const GimpDrawable *drawable);
 gint            gimp_drawable_bytes_with_alpha   (const GimpDrawable *drawable);
 gint            gimp_drawable_bytes_without_alpha(const GimpDrawable *drawable);
+gboolean        gimp_drawable_uses_gegl          (const GimpDrawable *drawable);
 
 gboolean        gimp_drawable_has_floating_sel   (const GimpDrawable *drawable);
 
Index: app/core/gimpimage.c
===================================================================
--- app/core/gimpimage.c	(revision 27949)
+++ app/core/gimpimage.c	(working copy)
@@ -115,7 +115,8 @@ enum
   PROP_ID,
   PROP_WIDTH,
   PROP_HEIGHT,
-  PROP_BASE_TYPE
+  PROP_BASE_TYPE,
+  PROP_FORMAT
 };
 
 
@@ -543,6 +544,11 @@ gimp_image_class_init (GimpImageClass *k
                                                       GIMP_PARAM_READWRITE |
                                                       G_PARAM_CONSTRUCT));
 
+  g_object_class_install_property (object_class, PROP_FORMAT,
+                                   g_param_spec_pointer ("format", NULL, NULL,
+                                                         GIMP_PARAM_READWRITE |
+                                                         G_PARAM_CONSTRUCT));
+
   gimp_image_color_hash_init ();
 }
 
@@ -766,6 +772,9 @@ gimp_image_set_property (GObject      *o
     case PROP_BASE_TYPE:
       image->base_type = g_value_get_enum (value);
       break;
+    case PROP_FORMAT:
+      image->format = g_value_get_pointer (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -797,6 +806,9 @@ gimp_image_get_property (GObject    *obj
     case PROP_BASE_TYPE:
       g_value_set_enum (value, image->base_type);
       break;
+    case PROP_FORMAT:
+      g_value_set_pointer (value, image->format);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
       break;
@@ -1329,6 +1341,22 @@ gimp_image_new (Gimp              *gimp,
                        NULL);
 }
 
+GimpImage *
+gimp_image_gegl_new (Gimp       *gimp,
+                     gint        width,
+                     gint        height,
+                     const Babl *format)
+{
+  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
+
+  return g_object_new (GIMP_TYPE_IMAGE,
+                       "gimp",   gimp,
+                       "width",  width,
+                       "height", height,
+                       "format", format,
+                       NULL);
+}
+
 GimpImageBaseType
 gimp_image_base_type (const GimpImage *image)
 {
@@ -2235,6 +2263,7 @@ gimp_image_transform_color (const GimpIm
                                                         src[BLUE]);
           break;
         }
+
       break;
 
     case GIMP_GRAY:
@@ -3718,10 +3747,13 @@ gimp_image_get_type_string (GimpImage *i
 {
   gboolean empty = gimp_image_is_empty (image);
 
+  if (image->format == babl_format ("RGB u16"))
+    return empty ? _("RGB16-empty") : _("RGB16");
+
   switch (gimp_image_base_type (image))
     {
-    case GIMP_RGB:     return empty ? _("RGB-empty")       : _("RGB");
-    case GIMP_GRAY:    return empty ? _("grayscale-empty") : _("grayscale");
+    case GIMP_RGB:     return empty ? _("RGB8-empty")      : _("RGB8");
+    case GIMP_GRAY:    return empty ? _("grayscale-empty") : _("grayscale8");
     case GIMP_INDEXED: return empty ? _("indexed-empty")   : _("indexed");
     default:           return "unknown";
     }
Index: app/core/gimpimage.h
===================================================================
--- app/core/gimpimage.h	(revision 27947)
+++ app/core/gimpimage.h	(working copy)
@@ -113,6 +113,8 @@ struct _GimpImage
   gdouble            yresolution;           /*  image y-res, in dpi          */
   GimpUnit           resolution_unit;       /*  resolution unit              */
   GimpImageBaseType  base_type;             /*  base gimp_image type         */
+  Babl              *format;                /*  babl format, will eventually
+                                                replace base_type            */
 
   guchar            *colormap;              /*  colormap (for indexed)       */
   gint               n_colors;              /*  # of colors (for indexed)    */
@@ -233,6 +235,11 @@ GimpImage     * gimp_image_new          
                                                   gint                height,
                                                   GimpImageBaseType   base_type);
 
+GimpImage     * gimp_image_gegl_new              (Gimp               *gimp,
+                                                  gint                width,
+                                                  gint                height,
+                                                  const Babl         *format);
+
 GimpImageBaseType  gimp_image_base_type            (const GimpImage  *image);
 GimpImageType      gimp_image_base_type_with_alpha (const GimpImage  *image);
 CombinationMode    gimp_image_get_combination_mode (GimpImageType     dest_type,
Index: app/core/gimpimagemap.c
===================================================================
--- app/core/gimpimagemap.c	(revision 27945)
+++ app/core/gimpimagemap.c	(working copy)
@@ -58,6 +58,7 @@ struct _GimpImageMap
   gchar                 *undo_desc;
 
   TileManager           *undo_tiles;
+  GeglBuffer            *undo_buffer;
   gint                   undo_offset_x;
   gint                   undo_offset_y;
 
@@ -146,6 +147,7 @@ gimp_image_map_init (GimpImageMap *image
   image_map->undo_tiles    = NULL;
   image_map->undo_offset_x = 0;
   image_map->undo_offset_y = 0;
+  image_map->undo_buffer   = NULL;
   image_map->apply_func    = NULL;
   image_map->apply_data    = NULL;
   image_map->PRI           = NULL;
@@ -191,6 +193,12 @@ gimp_image_map_finalize (GObject *object
       image_map->undo_tiles = NULL;
     }
 
+  if (image_map->undo_buffer)
+    {
+      g_object_unref (image_map->undo_buffer);
+      image_map->undo_buffer = NULL;
+    }
+
   if (image_map->idle_id)
     {
       g_source_remove (image_map->idle_id);
@@ -396,6 +404,13 @@ gimp_image_map_apply (GimpImageMap      
       undo_width    = tile_manager_width  (image_map->undo_tiles);
       undo_height   = tile_manager_height (image_map->undo_tiles);
     }
+  else if (image_map->undo_buffer)
+    {
+      undo_offset_x = image_map->undo_offset_x;
+      undo_offset_y = image_map->undo_offset_y;
+      undo_width    = gegl_buffer_get_extent (image_map->undo_buffer)->width;
+      undo_height   = gegl_buffer_get_extent (image_map->undo_buffer)->height;
+    }
   else
     {
       undo_offset_x = 0;
@@ -404,11 +419,49 @@ gimp_image_map_apply (GimpImageMap      
       undo_height   = 0;
     }
 
-  if (! image_map->undo_tiles     ||
-      undo_offset_x != rect.x     ||
-      undo_offset_y != rect.y     ||
-      undo_width    != rect.width ||
-      undo_height   != rect.height)
+  if (gimp_drawable_uses_gegl (image_map->drawable) &&
+      (! image_map->undo_buffer ||
+       undo_offset_x != rect.x       ||
+       undo_offset_y != rect.y       ||
+       undo_width    != rect.width   ||
+       undo_height   != rect.height))
+    {
+      GeglBuffer *source = gimp_drawable_get_buffer (image_map->drawable);
+      const Babl *format = gegl_buffer_get_format (source);
+
+      /* If either the extents changed or the tiles don't exist,
+       * allocate new
+       */
+      if (! image_map->undo_buffer ||
+          undo_width  != rect.width     ||
+          undo_height != rect.height)
+        {
+          
+          /*  Destroy old tiles  */
+          if (image_map->undo_buffer)
+            g_object_unref (image_map->undo_buffer);
+
+          /*  Allocate new tiles  */
+          image_map->undo_buffer =
+            gegl_buffer_new (&rect,
+                             format);
+        }
+
+      gegl_buffer_copy (source,
+                        NULL,
+                        image_map->undo_buffer,
+                        NULL);
+
+      /*  Set the offsets  */
+      image_map->undo_offset_x = rect.x;
+      image_map->undo_offset_y = rect.y;
+    }
+  else if (! gimp_drawable_uses_gegl (image_map->drawable) &&
+           (! image_map->undo_tiles     ||
+            undo_offset_x != rect.x     ||
+            undo_offset_y != rect.y     ||
+            undo_width    != rect.width ||
+            undo_height   != rect.height))
     {
       /* If either the extents changed or the tiles don't exist,
        * allocate new
@@ -529,25 +582,45 @@ gimp_image_map_apply (GimpImageMap      
             }
         }
 
-      gegl_node_set (image_map->input,
-                     "tile-manager", image_map->undo_tiles,
-                     "linear",       TRUE,
-                     NULL);
+      if (gimp_drawable_uses_gegl (image_map->drawable))
+        {
+          gegl_node_set (image_map->input,
+                         "buffer", image_map->undo_buffer,
+                         "linear", TRUE,
+                         NULL);
+        }
+      else
+        {
+          gegl_node_set (image_map->input,
+                         "tile-manager", image_map->undo_tiles,
+                         "linear",       TRUE,
+                         NULL);
+        }
 
       gegl_node_set (image_map->translate,
                      "x", (gdouble) rect.x,
                      "y", (gdouble) rect.y,
                      NULL);
 
-      gegl_node_set (image_map->output,
-                     "tile-manager", gimp_drawable_get_shadow_tiles (image_map->drawable),
-                     "linear",       TRUE,
-                     NULL);
+      if (gimp_drawable_uses_gegl (image_map->drawable))
+        {
+          gegl_node_set (image_map->output,
+                         "buffer", gimp_drawable_get_shadow_buffer (image_map->drawable),
+                         "linear", TRUE,
+                         NULL);
+        }
+      else
+        {
+          gegl_node_set (image_map->output,
+                         "tile-manager", gimp_drawable_get_shadow_tiles (image_map->drawable),
+                         "linear",       TRUE,
+                         NULL);
+        }
 
       image_map->processor = gegl_node_new_processor (image_map->output,
                                                       &rect);
     }
-  else
+  else if (! gimp_drawable_uses_gegl (image_map->drawable))
     {
       /*  Configure the src from the drawable data  */
       pixel_region_init (&image_map->srcPR,
@@ -646,7 +719,20 @@ gimp_image_map_clear (GimpImageMap *imag
     return;
 
   /*  restore the original image  */
-  if (image_map->undo_tiles)
+  if (gimp_drawable_uses_gegl (image_map->drawable))
+    {
+      gegl_buffer_copy (image_map->undo_buffer,
+                        NULL,
+                        gimp_drawable_get_buffer (image_map->drawable),
+                        NULL);
+
+      gimp_drawable_update_extent (image_map->drawable,
+                                   gegl_buffer_get_extent (gimp_drawable_get_buffer (image_map->drawable)));
+
+      g_object_unref (image_map->undo_buffer);
+      image_map->undo_buffer = NULL;
+    }
+  else if (image_map->undo_tiles)
     {
       PixelRegion srcPR;
       PixelRegion destPR;
@@ -766,7 +852,7 @@ gimp_image_map_do (GimpImageMap *image_m
           return FALSE;
         }
     }
-  else
+  else if (! gimp_drawable_uses_gegl (image_map->drawable))
     {
       gint i;
 
@@ -845,7 +931,6 @@ gimp_image_map_do (GimpImageMap *image_m
 
   return TRUE;
 }
-
 static void
 gimp_image_map_data_written (GObject             *operation,
                              const GeglRectangle *extent,
@@ -860,34 +945,55 @@ gimp_image_map_data_written (GObject    
 #endif
 
   /* Reset to initial drawable conditions. */
-  pixel_region_init (&srcPR, image_map->undo_tiles,
-                     extent->x - image_map->undo_offset_x,
-                     extent->y - image_map->undo_offset_y,
-                     extent->width,
-                     extent->height,
-                     FALSE);
-  pixel_region_init (&destPR, gimp_drawable_get_tiles (image_map->drawable),
-                     extent->x,
-                     extent->y,
-                     extent->width,
-                     extent->height,
-                     TRUE);
-  copy_region (&srcPR, &destPR);
+  if (gimp_drawable_uses_gegl (image_map->drawable))
+    {
+      gegl_buffer_copy (image_map->undo_buffer,
+                        extent,
+                        gimp_drawable_get_buffer (image_map->drawable),
+                        extent);
+    }
+  else
+    {
+      pixel_region_init (&srcPR, image_map->undo_tiles,
+                         extent->x - image_map->undo_offset_x,
+                         extent->y - image_map->undo_offset_y,
+                         extent->width,
+                         extent->height,
+                         FALSE);
+      pixel_region_init (&destPR, gimp_drawable_get_tiles (image_map->drawable),
+                         extent->x,
+                         extent->y,
+                         extent->width,
+                         extent->height,
+                         TRUE);
+      copy_region (&srcPR, &destPR);
+    }
 
   /* Apply the result of the gegl graph. */
-  pixel_region_init (&srcPR,
-                     gimp_drawable_get_shadow_tiles (image_map->drawable),
-                     extent->x,
-                     extent->y,
-                     extent->width,
-                     extent->height,
-                     FALSE);
-
-  gimp_drawable_apply_region (image_map->drawable, &srcPR,
-                              FALSE, NULL,
-                              GIMP_OPACITY_OPAQUE, GIMP_REPLACE_MODE,
-                              NULL, NULL,
-                              extent->x, extent->y);
+  if (gimp_drawable_uses_gegl (image_map->drawable))
+    {
+      /* FIXME: Do proper blending, not just copying */
+      gegl_buffer_copy (gimp_drawable_get_shadow_buffer (image_map->drawable),
+                        extent,
+                        gimp_drawable_get_buffer (image_map->drawable),
+                        extent);
+    }
+  else
+    {
+      pixel_region_init (&srcPR,
+                         gimp_drawable_get_shadow_tiles (image_map->drawable),
+                         extent->x,
+                         extent->y,
+                         extent->width,
+                         extent->height,
+                         FALSE);
+
+      gimp_drawable_apply_region (image_map->drawable, &srcPR,
+                                  FALSE, NULL,
+                                  GIMP_OPACITY_OPAQUE, GIMP_REPLACE_MODE,
+                                  NULL, NULL,
+                                  extent->x, extent->y);
+    }
 
   gimp_drawable_update (image_map->drawable,
                         extent->x, extent->y,
Index: app/core/gimplayer-project.c
===================================================================
--- app/core/gimplayer-project.c	(revision 27945)
+++ app/core/gimplayer-project.c	(working copy)
@@ -46,6 +46,10 @@ gimp_layer_project_region (GimpDrawable 
   GimpLayer     *layer = GIMP_LAYER (drawable);
   GimpLayerMask *mask  = gimp_layer_get_mask (layer);
 
+  /* Futile */
+  if (gimp_drawable_uses_gegl (drawable))
+    return;
+
   if (mask && gimp_layer_mask_get_show (mask))
     {
       /*  If we're showing the layer mask instead of the layer...  */
Index: app/core/gimplayer.c
===================================================================
--- app/core/gimplayer.c	(revision 27945)
+++ app/core/gimplayer.c	(working copy)
@@ -1029,6 +1029,37 @@ gimp_layer_new (GimpImage            *im
   return layer;
 }
 
+GimpLayer *
+gimp_layer_gegl_new (GimpImage            *image,
+                     gint                  width,
+                     gint                  height,
+                     const Babl           *format,
+                     const gchar          *name,
+                     gdouble               opacity,
+                     GimpLayerModeEffects  mode)
+{
+  GimpLayer *layer;
+
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
+  g_return_val_if_fail (width > 0, NULL);
+  g_return_val_if_fail (height > 0, NULL);
+
+  layer = g_object_new (GIMP_TYPE_LAYER, NULL);
+
+  gimp_drawable_gegl_configure (GIMP_DRAWABLE (layer),
+                                image,
+                                0, 0, width, height,
+                                format,
+                                name);
+
+  opacity = CLAMP (opacity, GIMP_OPACITY_TRANSPARENT, GIMP_OPACITY_OPAQUE);
+
+  layer->opacity = opacity;
+  layer->mode    = mode;
+
+  return layer;
+}
+
 /**
  * gimp_layer_new_from_tiles:
  * @tiles:      The buffer to make the new layer from.
Index: app/core/gimplayer.h
===================================================================
--- app/core/gimplayer.h	(revision 27945)
+++ app/core/gimplayer.h	(working copy)
@@ -77,6 +77,14 @@ GimpLayer     * gimp_layer_new          
                                                 gdouble               opacity,
                                                 GimpLayerModeEffects  mode);
 
+GimpLayer     * gimp_layer_gegl_new            (GimpImage            *image,
+                                                gint                  width,
+                                                gint                  height,
+                                                const Babl           *format,
+                                                const gchar          *name,
+                                                gdouble               opacity,
+                                                GimpLayerModeEffects  mode);
+
 GimpLayer     * gimp_layer_new_from_tiles      (TileManager          *tiles,
                                                 GimpImage            *dest_image,
                                                 GimpImageType         type,
Index: app/core/gimpprojection.c
===================================================================
--- app/core/gimpprojection.c	(revision 27945)
+++ app/core/gimpprojection.c	(working copy)
@@ -246,6 +246,10 @@ gimp_projection_estimate_memsize (GimpIm
     case GIMP_GRAY:
       bytes = 2;
       break;
+
+    default:
+      bytes = 4;
+      break;
     }
 
   /* The pyramid levels constitute a geometric sum with a ratio of 1/4. */
@@ -291,6 +295,9 @@ gimp_projection_get_image_type (GimpPick
 
     case GIMP_GRAY:
       return GIMP_GRAYA_IMAGE;
+
+    default:
+      return GIMP_RGBA_IMAGE;
     }
 
   g_assert_not_reached ();
Index: app/gegl/Makefile.am
===================================================================
--- app/gegl/Makefile.am	(revision 27945)
+++ app/gegl/Makefile.am	(working copy)
@@ -20,6 +20,8 @@ libappgegl_a_SOURCES = \
 	gimp-gegl.h			\
 	gimp-gegl-utils.c		\
 	gimp-gegl-utils.h		\
+	gimpgeglimage.c			\
+	gimpgeglimage.h			\
 	\
 	gimpbrightnesscontrastconfig.c	\
 	gimpbrightnesscontrastconfig.h	\
Index: app/gegl/gimpgeglimage.c
===================================================================
--- app/gegl/gimpgeglimage.c	(revision 0)
+++ app/gegl/gimpgeglimage.c	(revision 0)
@@ -0,0 +1,204 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimp-gegl-utils.h
+ * Copyright (C) 2009 Martin Nordholts <martinn@svn.gnome.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include "gegl-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpimage.h"
+#include "core/gimplayer.h"
+#include "core/gimpparamspecs.h"
+
+#include "pdb/gimppdb.h"
+#include "pdb/gimpprocedure.h"
+
+#include "gimpgeglimage.h"
+
+
+static GValueArray *
+gegl_png_load_invoker (GimpProcedure      *procedure,
+                       Gimp               *gimp,
+                       GimpContext        *context,
+                       GimpProgress       *progress,
+                       const GValueArray  *args,
+                       GError            **error)
+{
+  GValueArray *return_vals = NULL;
+  const gchar *path         = g_value_get_string (&args->values[1]);
+  GimpImage   *image       = NULL;
+
+  image = gimp_gegl_open_image (gimp, path);
+
+  return_vals = gimp_procedure_get_return_values (procedure,
+                                                  image != NULL,
+                                                  error ? *error : NULL);
+
+  if (image != NULL)
+    gimp_value_set_image (&return_vals->values[1], image);
+
+  return return_vals;
+}
+
+static GValueArray *
+gegl_png_save_invoker (GimpProcedure      *procedure,
+                       Gimp               *gimp,
+                       GimpContext        *context,
+                       GimpProgress       *progress,
+                       const GValueArray  *args,
+                       GError            **error)
+{
+  const gchar  *path        = NULL;
+  GimpImage    *image       = NULL;
+  GimpDrawable *drawable    = NULL;
+  gboolean      success     = TRUE;
+
+  image    = gimp_value_get_image (&args->values[1], gimp);
+  drawable = gimp_value_get_drawable (&args->values[2], gimp);
+  path     = g_value_get_string (&args->values[3]);
+
+  success = gimp_gegl_save_image (gimp, image, drawable, path);
+
+  return gimp_procedure_get_return_values (procedure,
+                                           success,
+                                           error ? *error : NULL);
+}
+
+void
+gimp_gegl_register_file_loaders (Gimp *gimp)
+{
+  GimpPDB       *pdb           = gimp->pdb;
+  GimpProcedure *gegl_png_load = NULL;
+  GimpProcedure *png_load      = NULL;
+  GimpProcedure *gegl_png_save = NULL;
+  GimpProcedure *png_save      = NULL;
+
+  /* These procedures will be called before the real ones registered
+   * by the file plug-ins
+   */
+
+  png_load = gimp_pdb_lookup_procedure (pdb, "file-png-load");
+  gegl_png_load = gimp_procedure_create_override (png_load, gegl_png_load_invoker);
+  gimp_pdb_register_procedure (pdb, gegl_png_load);
+
+  png_save = gimp_pdb_lookup_procedure (pdb, "file-png-save-defaults");
+  gegl_png_save = gimp_procedure_create_override (png_save, gegl_png_save_invoker);
+  gimp_pdb_register_procedure (pdb, gegl_png_save);
+
+}
+
+GimpImage *
+gimp_gegl_open_image (Gimp *gimp,
+                      const gchar *path)
+{
+  GimpImage     *image       = NULL;
+  GimpLayer     *layer       = NULL;
+  GeglBuffer    *gegl_buffer = NULL;
+  GeglNode      *graph       = NULL;
+  GeglNode      *png_load    = NULL;
+  GeglRectangle  png_size    = { 0, };
+  guint16       *temp_buf    = NULL;
+
+  /* Load the png */
+  graph = gegl_node_new ();
+
+  png_load = gegl_node_new_child (graph,
+                                  "operation", "gegl:png-load",
+                                  "path",      path,
+                                  NULL);
+
+  png_size = gegl_node_get_bounding_box (png_load);
+
+  temp_buf = g_malloc (sizeof (guint16) * 4 * png_size.width * png_size.height);
+
+  gegl_node_blit (png_load,
+                  1.0,
+                  &png_size,
+                  babl_format ("RGBA u16"),
+                  temp_buf,
+                  GEGL_AUTO_ROWSTRIDE,
+                  GEGL_BLIT_DEFAULT);
+
+  /* Create a new image with a layer and copy the png data to the
+   * layer
+   */
+  image = gimp_image_gegl_new (gimp,
+                               png_size.width,
+                               png_size.height,
+                               babl_format ("RGB u16"));
+
+  layer = gimp_layer_gegl_new (image,
+                               png_size.width,
+                               png_size.height,
+                               babl_format ("RGBA u16"),
+                               "A 16-bit layer!",
+                               1.0,
+                               GIMP_NORMAL_MODE);
+
+  gegl_buffer = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
+
+  gegl_buffer_set (gegl_buffer,
+                   &png_size,
+                   babl_format ("RGBA u16"),
+                   temp_buf,
+                   GEGL_AUTO_ROWSTRIDE);
+
+  gimp_image_add_layer (image, layer, 0, FALSE);
+
+  g_free (temp_buf);
+  g_object_unref (graph);
+
+  return image;
+}
+
+gboolean
+gimp_gegl_save_image (Gimp         *gimp,
+                      GimpImage    *image,
+                      GimpDrawable *drawable,
+                      const gchar  *path)
+{
+  GeglNode *graph    = NULL;
+  GeglNode *png_save = NULL;
+  GeglNode *source   = NULL;
+
+  graph = gegl_node_new ();
+
+  png_save = gegl_node_new_child (graph,
+                                  "operation",   "gegl:png-save",
+                                  "path",        path,
+                                  "compression", 9,
+                                  "bitdepth",    16,
+                                  NULL);
+
+  source = gegl_node_new_child (graph,
+                                "operation", "gimp:tilemanager-source",
+                                "buffer",    gimp_drawable_get_buffer (drawable),
+                                NULL);
+
+  gegl_node_link_many (source, png_save, NULL);
+
+  gegl_node_process (png_save);
+
+  g_object_unref (graph);
+
+  return TRUE;
+}
Index: app/gegl/gimpgeglimage.h
===================================================================
--- app/gegl/gimpgeglimage.h	(revision 0)
+++ app/gegl/gimpgeglimage.h	(revision 0)
@@ -0,0 +1,35 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimp-gegl-utils.h
+ * Copyright (C) 2007 Michael Natterer <mitch@gimp.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GIMP_GEGL_IMAGE_H
+#define GIMP_GEGL_IMAGE_H
+
+
+void       gimp_gegl_register_file_loaders (Gimp         *gimp);
+GimpImage *gimp_gegl_open_image            (Gimp         *gimp,
+                                            const gchar  *path);
+gboolean   gimp_gegl_save_image            (Gimp         *gimp,
+                                            GimpImage    *image,
+                                            GimpDrawable *drawable,
+                                            const gchar  *path);
+
+
+
+#endif
Index: app/gegl/gimpoperationtilesink.c
===================================================================
--- app/gegl/gimpoperationtilesink.c	(revision 27945)
+++ app/gegl/gimpoperationtilesink.c	(working copy)
@@ -38,6 +38,7 @@
 enum
 {
   PROP_0,
+  PROP_BUFFER,
   PROP_TILE_MANAGER,
   PROP_LINEAR
 };
@@ -101,6 +102,14 @@ gimp_operation_tile_sink_class_init (Gim
   sink_class->needs_full       = FALSE;
 
 
+  g_object_class_install_property (object_class, PROP_BUFFER,
+                                   g_param_spec_object ("buffer",
+                                                        "Buffer",
+                                                        "The GeglBuffer to use as a destination",
+                                                        GEGL_TYPE_BUFFER,
+                                                        G_PARAM_READWRITE |
+                                                        G_PARAM_CONSTRUCT));
+
   g_object_class_install_property (object_class, PROP_TILE_MANAGER,
                                    g_param_spec_boxed ("tile-manager",
                                                        "Tile Manager",
@@ -147,6 +156,10 @@ gimp_operation_tile_sink_get_property (G
 
   switch (property_id)
     {
+    case PROP_BUFFER:
+      g_value_set_object (value, self->buffer);
+      break;
+
     case PROP_TILE_MANAGER:
       g_value_set_boxed (value, self->tile_manager);
       break;
@@ -171,6 +184,12 @@ gimp_operation_tile_sink_set_property (G
 
   switch (property_id)
     {
+    case PROP_BUFFER:
+      if (self->buffer)
+        g_object_unref (self->buffer);
+      self->buffer = g_value_dup_object (value);
+      break;
+
     case PROP_TILE_MANAGER:
       if (self->tile_manager)
         tile_manager_unref (self->tile_manager);
@@ -196,29 +215,43 @@ gimp_operation_tile_sink_process (GeglOp
   const Babl            *format;
   PixelRegion            destPR;
   gpointer               pr;
+  gboolean               processed = FALSE;
 
-  if (! self->tile_manager)
-    return FALSE;
+  if (self->buffer)
+    {
+      gegl_buffer_copy (input,
+                        result,
+                        self->buffer,
+                        result);
 
-  format = gimp_bpp_to_babl_format (tile_manager_bpp (self->tile_manager),
-                                    self->linear);
+      g_signal_emit (operation, tile_sink_signals[DATA_WRITTEN], 0, result);
 
-  pixel_region_init (&destPR, self->tile_manager,
-                     result->x,     result->y,
-                     result->width, result->height,
-                     TRUE);
-
-  for (pr = pixel_regions_register (1, &destPR);
-       pr;
-       pr = pixel_regions_process (pr))
+      processed = TRUE;
+    }
+  if (self->tile_manager)
     {
-      GeglRectangle rect = { destPR.x, destPR.y, destPR.w, destPR.h };
+      format = gimp_bpp_to_babl_format (tile_manager_bpp (self->tile_manager),
+                                        self->linear);
 
-      gegl_buffer_get (input,
-                       1.0, &rect, format, destPR.data, destPR.rowstride);
-    }
+      pixel_region_init (&destPR, self->tile_manager,
+                         result->x,     result->y,
+                         result->width, result->height,
+                         TRUE);
+
+      for (pr = pixel_regions_register (1, &destPR);
+           pr;
+           pr = pixel_regions_process (pr))
+        {
+          GeglRectangle rect = { destPR.x, destPR.y, destPR.w, destPR.h };
+
+          gegl_buffer_get (input,
+                           1.0, &rect, format, destPR.data, destPR.rowstride);
+        }
 
-  g_signal_emit (operation, tile_sink_signals[DATA_WRITTEN], 0, result);
+      g_signal_emit (operation, tile_sink_signals[DATA_WRITTEN], 0, result);
+
+      processed = TRUE;
+    }
 
-  return TRUE;
+  return processed;
 }
Index: app/gegl/gimpoperationtilesink.h
===================================================================
--- app/gegl/gimpoperationtilesink.h	(revision 27945)
+++ app/gegl/gimpoperationtilesink.h	(working copy)
@@ -37,6 +37,7 @@ struct _GimpOperationTileSink
 {
   GeglOperationSink  parent_instance;
 
+  GeglBuffer        *buffer;
   TileManager       *tile_manager;
   gboolean           linear; /* should linear data be assumed */
 };
Index: app/gegl/gimpoperationtilesource.c
===================================================================
--- app/gegl/gimpoperationtilesource.c	(revision 27945)
+++ app/gegl/gimpoperationtilesource.c	(working copy)
@@ -37,6 +37,7 @@
 enum
 {
   PROP_0,
+  PROP_BUFFER,
   PROP_TILE_MANAGER,
   PROP_LINEAR
 };
@@ -91,6 +92,14 @@ gimp_operation_tile_source_class_init (G
   source_class->process               = gimp_operation_tile_source_process;
 
 
+  g_object_class_install_property (object_class, PROP_BUFFER,
+                                   g_param_spec_object ("buffer",
+                                                        "Buffer",
+                                                        "The GeglBuffer to use as source",
+                                                        GEGL_TYPE_BUFFER,
+                                                        G_PARAM_READWRITE |
+                                                        G_PARAM_CONSTRUCT));
+
   g_object_class_install_property (object_class, PROP_TILE_MANAGER,
                                    g_param_spec_boxed ("tile-manager",
                                                        "Tile Manager",
@@ -137,6 +146,10 @@ gimp_operation_tile_source_get_property 
 
   switch (property_id)
     {
+    case PROP_BUFFER:
+      g_value_set_object (value, self->buffer);
+      break;
+
     case PROP_TILE_MANAGER:
       g_value_set_boxed (value, self->tile_manager);
       break;
@@ -161,6 +174,12 @@ gimp_operation_tile_source_set_property 
 
   switch (property_id)
     {
+    case PROP_BUFFER:
+      if (self->buffer)
+        g_object_unref (self->buffer);
+      self->buffer = g_value_dup_object (value);
+      break;
+
     case PROP_TILE_MANAGER:
       if (self->tile_manager)
         tile_manager_unref (self->tile_manager);
@@ -182,9 +201,8 @@ gimp_operation_tile_source_prepare (Gegl
 {
   GimpOperationTileSource *self = GIMP_OPERATION_TILE_SOURCE (operation);
 
-  if (self->tile_manager)
+  if (self->buffer || self->tile_manager)
     {
-
       gegl_operation_set_format (operation, "output", babl_format("RaGaBaA float"));
     }
 }
@@ -195,7 +213,11 @@ gimp_operation_tile_source_get_bounding_
   GimpOperationTileSource *self   = GIMP_OPERATION_TILE_SOURCE (operation);
   GeglRectangle            result = { 0, };
 
-  if (self->tile_manager)
+  if (self->buffer)
+    {
+      result = *gegl_buffer_get_extent (self->buffer);
+    }
+  else if (self->tile_manager)
     {
       result.x      = 0;
       result.y      = 0;
@@ -215,26 +237,38 @@ gimp_operation_tile_source_process (Gegl
   const Babl              *format;
   PixelRegion              srcPR;
   gpointer                 pr;
+  gboolean                 processed = FALSE;
 
-  if (! self->tile_manager)
-    return FALSE;
+  if (self->buffer)
+    {
+      gegl_buffer_copy (self->buffer,
+                        gegl_buffer_get_extent (self->buffer),
+                        output,
+                        gegl_buffer_get_extent (self->buffer));
 
-  format = gimp_bpp_to_babl_format (tile_manager_bpp (self->tile_manager),
-                                    self->linear);
+      processed = TRUE;
+    }
+  else if (self->tile_manager)
+    {
+      format = gimp_bpp_to_babl_format (tile_manager_bpp (self->tile_manager),
+                                        self->linear);
 
-  pixel_region_init (&srcPR, self->tile_manager,
-                     result->x,     result->y,
-                     result->width, result->height,
-                     FALSE);
+      pixel_region_init (&srcPR, self->tile_manager,
+                         result->x,     result->y,
+                         result->width, result->height,
+                         FALSE);
 
-  for (pr = pixel_regions_register (1, &srcPR);
-       pr;
-       pr = pixel_regions_process (pr))
-    {
-      GeglRectangle rect = { srcPR.x, srcPR.y, srcPR.w, srcPR.h };
+      for (pr = pixel_regions_register (1, &srcPR);
+           pr;
+           pr = pixel_regions_process (pr))
+        {
+          GeglRectangle rect = { srcPR.x, srcPR.y, srcPR.w, srcPR.h };
+
+          gegl_buffer_set (output, &rect, format, srcPR.data, srcPR.rowstride);
+        }
 
-      gegl_buffer_set (output, &rect, format, srcPR.data, srcPR.rowstride);
+      processed = TRUE;
     }
 
-  return TRUE;
+  return processed;
 }
Index: app/gegl/gimpoperationtilesource.h
===================================================================
--- app/gegl/gimpoperationtilesource.h	(revision 27945)
+++ app/gegl/gimpoperationtilesource.h	(working copy)
@@ -38,6 +38,7 @@ struct _GimpOperationTileSource
   GeglOperationSource  parent_instance;
 
   TileManager         *tile_manager;
+  GeglBuffer          *buffer;
   gboolean             linear; /* should linear data be assumed */
 };
 
