[gimp/goat-invasion: 225/241] app: support TempBuf backed buffer in gimp_drawable_apply_buffer()



commit be1971486b0dafdc9a3d2ea368ab7758766d8259
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 22 22:47:11 2012 +0100

    app: support TempBuf backed buffer in gimp_drawable_apply_buffer()

 app/core/gimpdrawable.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index b606dae..471a5cc 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -1247,19 +1247,31 @@ gimp_drawable_apply_buffer (GimpDrawable         *drawable,
                             gint                  x,
                             gint                  y)
 {
-  PixelRegion src2PR;
+  TempBuf     *temp_buf;
+  PixelRegion  src2PR;
 
   g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
   g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
   g_return_if_fail (GEGL_IS_BUFFER (buffer));
   g_return_if_fail (buffer_rect != NULL);
 
-  pixel_region_init (&src2PR, gimp_gegl_buffer_get_tiles (buffer),
-                     buffer_rect->x, buffer_rect->y,
-                     buffer_rect->width, buffer_rect->height,
-                     FALSE);
+  temp_buf = gimp_gegl_buffer_get_temp_buf (buffer);
+
+  if (temp_buf)
+    {
+      pixel_region_init_temp_buf (&src2PR, temp_buf,
+                                  buffer_rect->x, buffer_rect->y,
+                                  buffer_rect->width, buffer_rect->height);
+    }
+  else
+    {
+      pixel_region_init (&src2PR, gimp_gegl_buffer_get_tiles (buffer),
+                         buffer_rect->x, buffer_rect->y,
+                         buffer_rect->width, buffer_rect->height,
+                         FALSE);
+    }
 
-  GIMP_DRAWABLE_GET_CLASS (drawable)->apply_region (drawable,& src2PR,
+  GIMP_DRAWABLE_GET_CLASS (drawable)->apply_region (drawable, &src2PR,
                                                     push_undo, undo_desc,
                                                     opacity, mode,
                                                     src1_tiles, destPR,



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