gimp r27573 - in trunk: . app/core



Author: mitch
Date: Sat Nov  8 17:23:21 2008
New Revision: 27573
URL: http://svn.gnome.org/viewvc/gimp?rev=27573&view=rev

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

	* app/core/gimpdrawable.[ch]: add new function
	gimp_drawable_init_src_region() which will initialize a
	PixelRegion on this drawable's "projection" (with the floating
	selection combined), but for now just uses drawable->tiles.

	* app/core/gimpchannel-project.c
	* app/core/gimplayer-project.c: use it instead of
	pixel_region_init() on the drawable's tiles.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpchannel-project.c
   trunk/app/core/gimpdrawable.c
   trunk/app/core/gimpdrawable.h
   trunk/app/core/gimplayer-project.c

Modified: trunk/app/core/gimpchannel-project.c
==============================================================================
--- trunk/app/core/gimpchannel-project.c	(original)
+++ trunk/app/core/gimpchannel-project.c	Sat Nov  8 17:23:21 2008
@@ -51,9 +51,8 @@
   gimp_rgba_get_uchar (&channel->color,
                        &col[0], &col[1], &col[2], &opacity);
 
-  pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
-                     x, y, width, height,
-                     FALSE);
+  gimp_drawable_init_src_region (drawable, &srcPR,
+                                 x, y, width, height);
 
   if (combine)
     {

Modified: trunk/app/core/gimpdrawable.c
==============================================================================
--- trunk/app/core/gimpdrawable.c	(original)
+++ trunk/app/core/gimpdrawable.c	Sat Nov  8 17:23:21 2008
@@ -1057,6 +1057,35 @@
                                                       projPR, combine);
 }
 
+void
+gimp_drawable_init_src_region (GimpDrawable *drawable,
+                               PixelRegion  *srcPR,
+                               gint          x,
+                               gint          y,
+                               gint          width,
+                               gint          height)
+{
+  g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+  g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
+  g_return_if_fail (srcPR != NULL);
+
+  if (gimp_drawable_has_floating_sel (drawable))
+    {
+      /*  FIXME: return the composite of the layer and the floating
+       *  selection.
+       */
+      pixel_region_init (srcPR, gimp_drawable_get_tiles (drawable),
+                         x, y, width, height,
+                         FALSE);
+    }
+  else
+    {
+      pixel_region_init (srcPR, gimp_drawable_get_tiles (drawable),
+                         x, y, width, height,
+                         FALSE);
+    }
+}
+
 TileManager *
 gimp_drawable_get_tiles (GimpDrawable *drawable)
 {

Modified: trunk/app/core/gimpdrawable.h
==============================================================================
--- trunk/app/core/gimpdrawable.h	(original)
+++ trunk/app/core/gimpdrawable.h	Sat Nov  8 17:23:21 2008
@@ -172,6 +172,12 @@
                                                   gint                height,
                                                   PixelRegion        *projPR,
                                                   gboolean            combine);
+void            gimp_drawable_init_src_region    (GimpDrawable       *drawable,
+                                                  PixelRegion        *srcPR,
+                                                  gint                x,
+                                                  gint                y,
+                                                  gint                width,
+                                                  gint                height);
 
 TileManager   * gimp_drawable_get_tiles          (GimpDrawable       *drawable);
 void            gimp_drawable_set_tiles          (GimpDrawable       *drawable,

Modified: trunk/app/core/gimplayer-project.c
==============================================================================
--- trunk/app/core/gimplayer-project.c	(original)
+++ trunk/app/core/gimplayer-project.c	Sat Nov  8 17:23:21 2008
@@ -53,10 +53,8 @@
 
       PixelRegion srcPR;
 
-      pixel_region_init (&srcPR,
-                         gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
-                         x, y, width, height,
-                         FALSE);
+      gimp_drawable_init_src_region (GIMP_DRAWABLE (mask), &srcPR,
+                                     x, y, width, height);
 
       copy_gray_to_region (&srcPR, projPR);
     }
@@ -72,17 +70,13 @@
       InitialMode      initial_mode;
       CombinationMode  combination_mode;
 
-      pixel_region_init (&srcPR,
-                         gimp_drawable_get_tiles (drawable),
-                         x, y, width, height,
-                         FALSE);
+      gimp_drawable_init_src_region (drawable, &srcPR,
+                                     x, y, width, height);
 
       if (mask && gimp_layer_mask_get_apply (mask))
         {
-          pixel_region_init (&maskPR,
-                             gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
-                             x, y, width, height,
-                             FALSE);
+          gimp_drawable_init_src_region (GIMP_DRAWABLE (mask), &maskPR,
+                                         x, y, width, height);
           mask_pr = &maskPR;
         }
 



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