[gimp/metadata-browser] app: port gimp_paint_core_paste() to gimp_drawable_apply_buffer()



commit 121f7ab3bac43be489a72c649194d96b756b1776
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 22 22:47:56 2012 +0100

    app: port gimp_paint_core_paste() to gimp_drawable_apply_buffer()
    
    using the new TempBuf-GeglBuffer.

 app/paint/gimppaintcore.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/app/paint/gimppaintcore.c b/app/paint/gimppaintcore.c
index e01fa59..e5ef499 100644
--- a/app/paint/gimppaintcore.c
+++ b/app/paint/gimppaintcore.c
@@ -858,7 +858,7 @@ gimp_paint_core_paste (GimpPaintCore            *core,
                        GimpPaintApplicationMode  mode)
 {
   TileManager *alt = NULL;
-  PixelRegion  srcPR;
+  GeglBuffer  *canvas_buffer;
 
   if (core->use_saved_proj)
     {
@@ -918,13 +918,15 @@ gimp_paint_core_paste (GimpPaintCore            *core,
     }
 
   /*  intialize canvas buf source pixel regions  */
-  pixel_region_init_temp_buf (&srcPR, core->canvas_buf,
-                              0, 0,
-                              core->canvas_buf->width,
-                              core->canvas_buf->height);
+  canvas_buffer =
+    gimp_temp_buf_create_buffer (core->canvas_buf,
+                                 gimp_drawable_get_format_with_alpha (drawable));
 
   /*  apply the paint area to the image  */
-  gimp_drawable_apply_region (drawable, &srcPR,
+  gimp_drawable_apply_buffer (drawable, canvas_buffer,
+                              GIMP_GEGL_RECT (0, 0,
+                                              core->canvas_buf->width,
+                                              core->canvas_buf->height),
                               FALSE, NULL,
                               image_opacity, paint_mode,
                               alt,  /*  specify an alternative src1  */
@@ -932,6 +934,8 @@ gimp_paint_core_paste (GimpPaintCore            *core,
                               core->canvas_buf->x,
                               core->canvas_buf->y);
 
+  g_object_unref (canvas_buffer);
+
   /*  Update the undo extents  */
   core->x1 = MIN (core->x1, core->canvas_buf->x);
   core->y1 = MIN (core->y1, core->canvas_buf->y);



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