gimp r26383 - in trunk: . app/core



Author: neo
Date: Tue Aug  5 15:27:18 2008
New Revision: 26383
URL: http://svn.gnome.org/viewvc/gimp?rev=26383&view=rev

Log:
2008-08-05  Sven Neumann  <sven gimp org>

	* app/core/gimpchannel.c (gimp_channel_scale): don't waste CPU
	cycles scaling an empty channel.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimpchannel.c

Modified: trunk/app/core/gimpchannel.c
==============================================================================
--- trunk/app/core/gimpchannel.c	(original)
+++ trunk/app/core/gimpchannel.c	Tue Aug  5 15:27:18 2008
@@ -589,15 +589,35 @@
                     GimpInterpolationType  interpolation_type,
                     GimpProgress          *progress)
 {
+  GimpChannel *channel = GIMP_CHANNEL (item);
+
   if (G_TYPE_FROM_INSTANCE (item) == GIMP_TYPE_CHANNEL)
     {
       new_offset_x = 0;
       new_offset_y = 0;
     }
 
-  GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height,
-                                         new_offset_x, new_offset_y,
-                                         interpolation_type, progress);
+  /*  don't waste CPU cycles scaling an empty channel  */
+  if (channel->bounds_known && channel->empty)
+    {
+      GimpDrawable *drawable  = GIMP_DRAWABLE (item);
+      TileManager  *new_tiles = tile_manager_new (new_width, new_height,
+                                                  drawable->bytes);
+
+      gimp_drawable_set_tiles_full (drawable,
+                                    gimp_item_is_attached (item), NULL,
+                                    new_tiles, gimp_drawable_type (drawable),
+                                    new_offset_x, new_offset_y);
+      tile_manager_unref (new_tiles);
+
+      gimp_channel_clear (GIMP_CHANNEL (item), NULL, FALSE);
+    }
+  else
+    {
+      GIMP_ITEM_CLASS (parent_class)->scale (item, new_width, new_height,
+                                             new_offset_x, new_offset_y,
+                                             interpolation_type, progress);
+    }
 }
 
 static void
@@ -1189,7 +1209,7 @@
       gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (channel));
     }
 
-  if (channel->bounds_known && !channel->empty)
+  if (channel->bounds_known && ! channel->empty)
     {
       pixel_region_init (&maskPR,
                          gimp_drawable_get_tiles (GIMP_DRAWABLE (channel)),



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