gimp r27574 - in trunk: . app/core app/paint



Author: mitch
Date: Sat Nov  8 19:52:18 2008
New Revision: 27574
URL: http://svn.gnome.org/viewvc/gimp?rev=27574&view=rev

Log:
2008-11-08  Michael Natterer  <mitch gimp org>

	* app/core/gimpdrawable.[ch]: add optional parameter "PixelRegion
	*destPR" to GimpDrawable::apply_region().

	* app/core/gimpdrawable-combine.[ch]: if the passed destPR is !=
	NULL, write the result of the combination into that region instead
	of the drawable's tiles. The region must have the exact size of
	the result.

	* app/core/gimp-edit.c
	* app/core/gimpchannel.c
	* app/core/gimpdrawable-blend.c
	* app/core/gimpdrawable-bucket-fill.c
	* app/core/gimpdrawable-shadow.c
	* app/core/gimpdrawable-stroke.c
	* app/core/gimpimagemap.c
	* app/core/gimplayer-floating-sel.c
	* app/paint/gimppaintcore.c: pass NULL as destPR. Code actually
	using this feature follows.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimp-edit.c
   trunk/app/core/gimpchannel.c
   trunk/app/core/gimpdrawable-blend.c
   trunk/app/core/gimpdrawable-bucket-fill.c
   trunk/app/core/gimpdrawable-combine.c
   trunk/app/core/gimpdrawable-combine.h
   trunk/app/core/gimpdrawable-shadow.c
   trunk/app/core/gimpdrawable-stroke.c
   trunk/app/core/gimpdrawable.c
   trunk/app/core/gimpdrawable.h
   trunk/app/core/gimpimagemap.c
   trunk/app/core/gimplayer-floating-sel.c
   trunk/app/paint/gimppaintcore.c

Modified: trunk/app/core/gimp-edit.c
==============================================================================
--- trunk/app/core/gimp-edit.c	(original)
+++ trunk/app/core/gimp-edit.c	Sat Nov  8 19:52:18 2008
@@ -527,7 +527,7 @@
                                   gimp_object_get_name (GIMP_OBJECT (undo)),
                                   gimp_context_get_opacity (context),
                                   gimp_context_get_paint_mode (context),
-                                  NULL,
+                                  NULL, NULL,
                                   undo->x,
                                   undo->y);
 
@@ -659,7 +659,7 @@
   gimp_drawable_apply_region (drawable, &bufPR,
                               TRUE, undo_desc,
                               opacity, paint_mode,
-                              NULL, x, y);
+                              NULL, NULL, x, y);
 
   tile_manager_unref (buf_tiles);
 

Modified: trunk/app/core/gimpchannel.c
==============================================================================
--- trunk/app/core/gimpchannel.c	(original)
+++ trunk/app/core/gimpchannel.c	Sat Nov  8 19:52:18 2008
@@ -142,6 +142,7 @@
                                               gdouble            opacity,
                                               GimpLayerModeEffects  mode,
                                               TileManager       *src1_tiles,
+                                              PixelRegion       *destPR,
                                               gint               x,
                                               gint               y);
 static void      gimp_channel_replace_region (GimpDrawable      *drawable,
@@ -782,6 +783,7 @@
                            gdouble               opacity,
                            GimpLayerModeEffects  mode,
                            TileManager          *src1_tiles,
+                           PixelRegion          *destPR,
                            gint                  x,
                            gint                  y)
 {
@@ -790,7 +792,7 @@
   GIMP_DRAWABLE_CLASS (parent_class)->apply_region (drawable, src2PR,
                                                     push_undo, undo_desc,
                                                     opacity, mode,
-                                                    src1_tiles,
+                                                    src1_tiles, destPR,
                                                     x, y);
 
   GIMP_CHANNEL (drawable)->bounds_known = FALSE;

Modified: trunk/app/core/gimpdrawable-blend.c
==============================================================================
--- trunk/app/core/gimpdrawable-blend.c	(original)
+++ trunk/app/core/gimpdrawable-blend.c	Sat Nov  8 19:52:18 2008
@@ -244,7 +244,7 @@
   gimp_drawable_apply_region (drawable, &bufPR,
                               TRUE, _("Blend"),
                               opacity, paint_mode,
-                              NULL, x, y);
+                              NULL, NULL, x, y);
 
   /*  update the image  */
   gimp_drawable_update (drawable, x, y, width, height);

Modified: trunk/app/core/gimpdrawable-bucket-fill.c
==============================================================================
--- trunk/app/core/gimpdrawable-bucket-fill.c	(original)
+++ trunk/app/core/gimpdrawable-bucket-fill.c	Sat Nov  8 19:52:18 2008
@@ -285,7 +285,7 @@
   gimp_drawable_apply_region (drawable, &bufPR,
                               TRUE, C_("command", "Bucket Fill"),
                               opacity, paint_mode,
-                              NULL, x1, y1);
+                              NULL, NULL, x1, y1);
   tile_manager_unref (buf_tiles);
 
   /*  update the image  */

Modified: trunk/app/core/gimpdrawable-combine.c
==============================================================================
--- trunk/app/core/gimpdrawable-combine.c	(original)
+++ trunk/app/core/gimpdrawable-combine.c	Sat Nov  8 19:52:18 2008
@@ -42,6 +42,7 @@
                                  gdouble               opacity,
                                  GimpLayerModeEffects  mode,
                                  TileManager          *src1_tiles,
+                                 PixelRegion          *destPR,
                                  gint                  x,
                                  gint                  y)
 {
@@ -50,7 +51,7 @@
   GimpChannel     *mask  = gimp_image_get_mask (image);
   gint             x1, y1, x2, y2;
   gint             offset_x, offset_y;
-  PixelRegion      src1PR, destPR;
+  PixelRegion      src1PR, my_destPR;
   CombinationMode  operation;
   gboolean         active_components[MAX_CHANNELS];
 
@@ -129,20 +130,33 @@
 
   /* configure the pixel regions */
 
-  /* If an alternative to using the drawable's data as src1 was provided...
+  /* check if an alternative to using the drawable's data as src1 was
+   * provided...
    */
   if (src1_tiles)
-    pixel_region_init (&src1PR, src1_tiles,
-                       x1, y1, x2 - x1, y2 - y1,
-                       FALSE);
+    {
+      pixel_region_init (&src1PR, src1_tiles,
+                         x1, y1, x2 - x1, y2 - y1,
+                         FALSE);
+    }
   else
-    pixel_region_init (&src1PR, gimp_drawable_get_tiles (drawable),
-                       x1, y1, x2 - x1, y2 - y1,
-                       FALSE);
+    {
+      pixel_region_init (&src1PR, gimp_drawable_get_tiles (drawable),
+                         x1, y1, x2 - x1, y2 - y1,
+                         FALSE);
+    }
+
+  /* check if an alternative to using the drawable's data as dest was
+   * provided...
+   */
+  if (!destPR)
+    {
+      pixel_region_init (&my_destPR, gimp_drawable_get_tiles (drawable),
+                         x1, y1, x2 - x1, y2 - y1,
+                         TRUE);
+      destPR = &my_destPR;
+    }
 
-  pixel_region_init (&destPR, gimp_drawable_get_tiles (drawable),
-                     x1, y1, x2 - x1, y2 - y1,
-                     TRUE);
   pixel_region_resize (src2PR,
                        src2PR->x + (x1 - x), src2PR->y + (y1 - y),
                        x2 - x1, y2 - y1);
@@ -158,7 +172,7 @@
                          x2 - x1, y2 - y1,
                          FALSE);
 
-      combine_regions (&src1PR, src2PR, &destPR, &maskPR, NULL,
+      combine_regions (&src1PR, src2PR, destPR, &maskPR, NULL,
                        opacity * 255.999,
                        mode,
                        active_components,
@@ -166,7 +180,7 @@
     }
   else
     {
-      combine_regions (&src1PR, src2PR, &destPR, NULL, NULL,
+      combine_regions (&src1PR, src2PR, destPR, NULL, NULL,
                        opacity * 255.999,
                        mode,
                        active_components,

Modified: trunk/app/core/gimpdrawable-combine.h
==============================================================================
--- trunk/app/core/gimpdrawable-combine.h	(original)
+++ trunk/app/core/gimpdrawable-combine.h	Sat Nov  8 19:52:18 2008
@@ -29,6 +29,7 @@
                                           gdouble               opacity,
                                           GimpLayerModeEffects  mode,
                                           TileManager          *src1_tiles,
+                                          PixelRegion          *destPR,
                                           gint                  x,
                                           gint                  y);
 void   gimp_drawable_real_replace_region (GimpDrawable         *drawable,

Modified: trunk/app/core/gimpdrawable-shadow.c
==============================================================================
--- trunk/app/core/gimpdrawable-shadow.c	(original)
+++ trunk/app/core/gimpdrawable-shadow.c	Sat Nov  8 19:52:18 2008
@@ -97,6 +97,6 @@
       gimp_drawable_apply_region (drawable, &shadowPR,
                                   push_undo, undo_desc,
                                   GIMP_OPACITY_OPAQUE, GIMP_REPLACE_MODE,
-                                  NULL, x, y);
+                                  NULL, NULL, x, y);
     }
 }

Modified: trunk/app/core/gimpdrawable-stroke.c
==============================================================================
--- trunk/app/core/gimpdrawable-stroke.c	(original)
+++ trunk/app/core/gimpdrawable-stroke.c	Sat Nov  8 19:52:18 2008
@@ -436,7 +436,7 @@
                               push_undo, _("Render Stroke"),
                               gimp_context_get_opacity (context),
                               gimp_context_get_paint_mode (context),
-                              NULL, x, y);
+                              NULL, NULL, x, y);
 
   tile_manager_unref (mask);
   tile_manager_unref (base);

Modified: trunk/app/core/gimpdrawable.c
==============================================================================
--- trunk/app/core/gimpdrawable.c	(original)
+++ trunk/app/core/gimpdrawable.c	Sat Nov  8 19:52:18 2008
@@ -1004,6 +1004,7 @@
                             gdouble               opacity,
                             GimpLayerModeEffects  mode,
                             TileManager          *src1_tiles,
+                            PixelRegion          *destPR,
                             gint                  x,
                             gint                  y)
 {
@@ -1014,7 +1015,7 @@
   GIMP_DRAWABLE_GET_CLASS (drawable)->apply_region (drawable, src2PR,
                                                     push_undo, undo_desc,
                                                     opacity, mode,
-                                                    src1_tiles,
+                                                    src1_tiles, destPR,
                                                     x, y);
 }
 

Modified: trunk/app/core/gimpdrawable.h
==============================================================================
--- trunk/app/core/gimpdrawable.h	(original)
+++ trunk/app/core/gimpdrawable.h	Sat Nov  8 19:52:18 2008
@@ -79,6 +79,7 @@
                                            gdouble               opacity,
                                            GimpLayerModeEffects  mode,
                                            TileManager          *src1_tiles,
+                                           PixelRegion          *destPR,
                                            gint                  x,
                                            gint                  y);
   void          (* replace_region)        (GimpDrawable         *drawable,
@@ -155,6 +156,7 @@
                                                   gdouble             opacity,
                                                   GimpLayerModeEffects  mode,
                                                   TileManager        *src1_tiles,
+                                                  PixelRegion        *destPR,
                                                   gint                x,
                                                   gint                y);
 void            gimp_drawable_replace_region     (GimpDrawable       *drawable,

Modified: trunk/app/core/gimpimagemap.c
==============================================================================
--- trunk/app/core/gimpimagemap.c	(original)
+++ trunk/app/core/gimpimagemap.c	Sat Nov  8 19:52:18 2008
@@ -815,7 +815,7 @@
           gimp_drawable_apply_region (image_map->drawable, &srcPR,
                                       FALSE, NULL,
                                       GIMP_OPACITY_OPAQUE, GIMP_REPLACE_MODE,
-                                      NULL,
+                                      NULL, NULL,
                                       x, y);
 
           gimp_drawable_update (image_map->drawable, x, y, w, h);
@@ -891,7 +891,7 @@
   gimp_drawable_apply_region (image_map->drawable, &srcPR,
                               FALSE, NULL,
                               GIMP_OPACITY_OPAQUE, GIMP_REPLACE_MODE,
-                              NULL,
+                              NULL, NULL,
                               extent->x, extent->y);
 
   gimp_drawable_update (image_map->drawable,

Modified: trunk/app/core/gimplayer-floating-sel.c
==============================================================================
--- trunk/app/core/gimplayer-floating-sel.c	(original)
+++ trunk/app/core/gimplayer-floating-sel.c	Sat Nov  8 19:52:18 2008
@@ -487,7 +487,7 @@
                                       push_undo, NULL,
                                       gimp_layer_get_opacity (layer),
                                       gimp_layer_get_mode (layer),
-                                      NULL,
+                                      NULL, NULL,
                                       (x1 - offx), (y1 - offy));
 
           /*  restore lock alpha  */

Modified: trunk/app/paint/gimppaintcore.c
==============================================================================
--- trunk/app/paint/gimppaintcore.c	(original)
+++ trunk/app/paint/gimppaintcore.c	Sat Nov  8 19:52:18 2008
@@ -857,6 +857,7 @@
                               FALSE, NULL,
                               image_opacity, paint_mode,
                               alt,  /*  specify an alternative src1  */
+                              NULL,
                               core->canvas_buf->x,
                               core->canvas_buf->y);
 



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