gimp r25510 - in trunk: . app/core app/pdb app/plug-in libgimp tools/pdbgen/pdb
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25510 - in trunk: . app/core app/pdb app/plug-in libgimp tools/pdbgen/pdb
- Date: Mon, 21 Apr 2008 18:20:52 +0100 (BST)
Author: mitch
Date: Mon Apr 21 17:20:51 2008
New Revision: 25510
URL: http://svn.gnome.org/viewvc/gimp?rev=25510&view=rev
Log:
2008-04-21 Michael Natterer <mitch gimp org>
Move the shadow tiles from the image to the drawable.
Fixes bug #100469.
* app/core/Makefile.am
* app/core/gimpdrawable-shadow.[ch]: new files implementing
the shadow tiles.
* app/core/gimpimage.[ch]: remove the shadow tile manager from the
GimpImage struct. Remove gimp_image_get_shadow_tiles() and
_free_shadow_tiles().
* app/core/gimpdrawable.[ch]: add the shadow tile manager
here. Remove get_shadow_tiles() and merge_shadow(). Free the
shadow tiles in finalize and when the drawable gets removed from
the image.
* app/core/gimpdrawable-brightness-contrast.c
* app/core/gimpdrawable-color-balance.c
* app/core/gimpdrawable-colorize.c
* app/core/gimpdrawable-curves.c
* app/core/gimpdrawable-desaturate.c
* app/core/gimpdrawable-equalize.c
* app/core/gimpdrawable-hue-saturation.c
* app/core/gimpdrawable-invert.c
* app/core/gimpdrawable-levels.c
* app/core/gimpdrawable-operation.c
* app/core/gimpdrawable-posterize.c
* app/core/gimpdrawable-threshold.c
* app/core/gimpimagemap.c: changed accordingly. Free the shadow tiles
after using them.
* app/plug-in/gimpplugin-cleanup.[ch]: add
gimp_plug_in_cleanup_add_shadow() and _remove_shadow() which keep
track of whether shadow tiles were created on behalf of a plug-in
procedure.
(gimp_plug_in_cleanup): free shadow tiles which were created but
not destroyed by a plug-in procedure.
* app/plug-in/gimpplugin-message.c (plug_in_handle_tile_request):
call gimp_plug_in_cleanup_add_shadow() whenever a plug-in requests
shadow tiles.
* tools/pdbgen/pdb/drawable.pdb: use the new drawable shadow
API. Add new procedure gimp-drawable-free-shadow. Call
gimp_plug_in_cleaup_remove_shadow() when it gets called.
* tools/pdbgen/pdb/image.pdb: deprecate gimp-image-free-shadow.
Calling it has no effect any longer.
* app/pdb/drawable-cmds.c
* app/pdb/image-cmds.c
* app/pdb/internal-procs.c
* libgimp/gimpimage_pdb.[ch]
* libgimp/gimpdrawable_pdb.[ch]: regenerated.
Added:
trunk/app/core/gimpdrawable-shadow.c
trunk/app/core/gimpdrawable-shadow.h
Modified:
trunk/ChangeLog
trunk/app/core/Makefile.am
trunk/app/core/gimpdrawable-brightness-contrast.c
trunk/app/core/gimpdrawable-color-balance.c
trunk/app/core/gimpdrawable-colorize.c
trunk/app/core/gimpdrawable-curves.c
trunk/app/core/gimpdrawable-desaturate.c
trunk/app/core/gimpdrawable-equalize.c
trunk/app/core/gimpdrawable-hue-saturation.c
trunk/app/core/gimpdrawable-invert.c
trunk/app/core/gimpdrawable-levels.c
trunk/app/core/gimpdrawable-operation.c
trunk/app/core/gimpdrawable-posterize.c
trunk/app/core/gimpdrawable-threshold.c
trunk/app/core/gimpdrawable.c
trunk/app/core/gimpdrawable.h
trunk/app/core/gimpimage.c
trunk/app/core/gimpimage.h
trunk/app/core/gimpimagemap.c
trunk/app/pdb/drawable-cmds.c
trunk/app/pdb/image-cmds.c
trunk/app/pdb/internal-procs.c
trunk/app/plug-in/gimpplugin-cleanup.c
trunk/app/plug-in/gimpplugin-cleanup.h
trunk/app/plug-in/gimpplugin-message.c
trunk/libgimp/gimpdrawable_pdb.c
trunk/libgimp/gimpdrawable_pdb.h
trunk/libgimp/gimpimage_pdb.c
trunk/libgimp/gimpimage_pdb.h
trunk/tools/pdbgen/pdb/drawable.pdb
trunk/tools/pdbgen/pdb/image.pdb
Modified: trunk/app/core/Makefile.am
==============================================================================
--- trunk/app/core/Makefile.am (original)
+++ trunk/app/core/Makefile.am Mon Apr 21 17:20:51 2008
@@ -143,6 +143,8 @@
gimpdrawable-posterize.h \
gimpdrawable-preview.c \
gimpdrawable-preview.h \
+ gimpdrawable-shadow.c \
+ gimpdrawable-shadow.h \
gimpdrawable-stroke.c \
gimpdrawable-stroke.h \
gimpdrawable-threshold.c \
Modified: trunk/app/core/gimpdrawable-brightness-contrast.c
==============================================================================
--- trunk/app/core/gimpdrawable-brightness-contrast.c (original)
+++ trunk/app/core/gimpdrawable-brightness-contrast.c Mon Apr 21 17:20:51 2008
@@ -36,6 +36,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-brightness-contrast.h"
#include "gimpdrawable-operation.h"
+#include "gimpdrawable-shadow.h"
#include "gimp-intl.h"
@@ -98,8 +99,10 @@
gimp_lut_free (lut);
- gimp_drawable_merge_shadow (drawable, TRUE,
- _("Brightness-Contrast"));
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE,
+ _("Brightness-Contrast"));
+ gimp_drawable_free_shadow_tiles (drawable);
+
gimp_drawable_update (drawable, x, y, width, height);
}
}
Modified: trunk/app/core/gimpdrawable-color-balance.c
==============================================================================
--- trunk/app/core/gimpdrawable-color-balance.c (original)
+++ trunk/app/core/gimpdrawable-color-balance.c Mon Apr 21 17:20:51 2008
@@ -35,6 +35,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-color-balance.h"
#include "gimpdrawable-operation.h"
+#include "gimpdrawable-shadow.h"
#include "gimp-intl.h"
@@ -103,7 +104,9 @@
pixel_regions_process_parallel ((PixelProcessorFunc) color_balance,
&cruft, 2, &srcPR, &destPR);
- gimp_drawable_merge_shadow (drawable, TRUE, _("Color Balance"));
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Color Balance"));
+ gimp_drawable_free_shadow_tiles (drawable);
+
gimp_drawable_update (drawable, x, y, width, height);
}
}
Modified: trunk/app/core/gimpdrawable-colorize.c
==============================================================================
--- trunk/app/core/gimpdrawable-colorize.c (original)
+++ trunk/app/core/gimpdrawable-colorize.c Mon Apr 21 17:20:51 2008
@@ -35,6 +35,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-operation.h"
#include "gimpdrawable-colorize.h"
+#include "gimpdrawable-shadow.h"
#include "gimp-intl.h"
@@ -96,7 +97,9 @@
pixel_regions_process_parallel ((PixelProcessorFunc) colorize,
&cruft, 2, &srcPR, &destPR);
- gimp_drawable_merge_shadow (drawable, TRUE, _("Colorize"));
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Colorize"));
+ gimp_drawable_free_shadow_tiles (drawable);
+
gimp_drawable_update (drawable, x, y, width, height);
}
}
Modified: trunk/app/core/gimpdrawable-curves.c
==============================================================================
--- trunk/app/core/gimpdrawable-curves.c (original)
+++ trunk/app/core/gimpdrawable-curves.c Mon Apr 21 17:20:51 2008
@@ -37,6 +37,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-curves.h"
#include "gimpdrawable-operation.h"
+#include "gimpdrawable-shadow.h"
#include "gimp-intl.h"
@@ -200,7 +201,9 @@
gimp_lut_free (lut);
- gimp_drawable_merge_shadow (drawable, TRUE, _("Curves"));
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Curves"));
+ gimp_drawable_free_shadow_tiles (drawable);
+
gimp_drawable_update (drawable, x, y, width, height);
}
}
Modified: trunk/app/core/gimpdrawable-desaturate.c
==============================================================================
--- trunk/app/core/gimpdrawable-desaturate.c (original)
+++ trunk/app/core/gimpdrawable-desaturate.c Mon Apr 21 17:20:51 2008
@@ -34,6 +34,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-desaturate.h"
#include "gimpdrawable-operation.h"
+#include "gimpdrawable-shadow.h"
#include "gimp-intl.h"
@@ -117,7 +118,8 @@
pixel_regions_process_parallel (function, GINT_TO_POINTER (has_alpha),
2, &srcPR, &destPR);
- gimp_drawable_merge_shadow (drawable, TRUE, _("Desaturate"));
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Desaturate"));
+ gimp_drawable_free_shadow_tiles (drawable);
gimp_drawable_update (drawable, x, y, width, height);
}
Modified: trunk/app/core/gimpdrawable-equalize.c
==============================================================================
--- trunk/app/core/gimpdrawable-equalize.c (original)
+++ trunk/app/core/gimpdrawable-equalize.c Mon Apr 21 17:20:51 2008
@@ -32,6 +32,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-equalize.h"
#include "gimpdrawable-histogram.h"
+#include "gimpdrawable-shadow.h"
#include "gimpimage.h"
#include "gimp-intl.h"
@@ -74,7 +75,8 @@
gimp_lut_free (lut);
gimp_histogram_unref (hist);
- gimp_drawable_merge_shadow (drawable, TRUE, _("Equalize"));
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Equalize"));
+ gimp_drawable_free_shadow_tiles (drawable);
gimp_drawable_update (drawable, x, y, width, height);
}
Modified: trunk/app/core/gimpdrawable-hue-saturation.c
==============================================================================
--- trunk/app/core/gimpdrawable-hue-saturation.c (original)
+++ trunk/app/core/gimpdrawable-hue-saturation.c Mon Apr 21 17:20:51 2008
@@ -33,8 +33,9 @@
#include "gimpimage.h"
#include "gimpdrawable.h"
-#include "gimpdrawable-operation.h"
#include "gimpdrawable-hue-saturation.h"
+#include "gimpdrawable-operation.h"
+#include "gimpdrawable-shadow.h"
#include "gimp-intl.h"
@@ -101,7 +102,10 @@
pixel_regions_process_parallel ((PixelProcessorFunc) hue_saturation,
&cruft, 2, &srcPR, &destPR);
- gimp_drawable_merge_shadow (drawable, TRUE, _("Hue_Saturation"));
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE,
+ _("Hue_Saturation"));
+ gimp_drawable_free_shadow_tiles (drawable);
+
gimp_drawable_update (drawable, x, y, width, height);
}
}
Modified: trunk/app/core/gimpdrawable-invert.c
==============================================================================
--- trunk/app/core/gimpdrawable-invert.c (original)
+++ trunk/app/core/gimpdrawable-invert.c Mon Apr 21 17:20:51 2008
@@ -34,6 +34,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-invert.h"
#include "gimpdrawable-operation.h"
+#include "gimpdrawable-shadow.h"
#include "gimpprogress.h"
#include "gimp-intl.h"
@@ -81,7 +82,8 @@
gimp_lut_free (lut);
- gimp_drawable_merge_shadow (drawable, TRUE, _("Invert"));
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Invert"));
+ gimp_drawable_free_shadow_tiles (drawable);
gimp_drawable_update (drawable, x, y, width, height);
}
Modified: trunk/app/core/gimpdrawable-levels.c
==============================================================================
--- trunk/app/core/gimpdrawable-levels.c (original)
+++ trunk/app/core/gimpdrawable-levels.c Mon Apr 21 17:20:51 2008
@@ -38,6 +38,7 @@
#include "gimpdrawable-histogram.h"
#include "gimpdrawable-levels.h"
#include "gimpdrawable-operation.h"
+#include "gimpdrawable-shadow.h"
#include "gimp-intl.h"
@@ -184,7 +185,8 @@
gimp_lut_free (lut);
- gimp_drawable_merge_shadow (drawable, TRUE, _("Levels"));
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Levels"));
+ gimp_drawable_free_shadow_tiles (drawable);
gimp_drawable_update (drawable, x, y, width, height);
}
Modified: trunk/app/core/gimpdrawable-operation.c
==============================================================================
--- trunk/app/core/gimpdrawable-operation.c (original)
+++ trunk/app/core/gimpdrawable-operation.c Mon Apr 21 17:20:51 2008
@@ -29,6 +29,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-operation.h"
+#include "gimpdrawable-shadow.h"
#include "gimpprogress.h"
#ifdef __GNUC__
@@ -75,10 +76,6 @@
"linear", linear,
NULL);
-#ifdef __GNUC__
-#warning FIXME: gegl_node_add_child() is not public API
-#endif
-
gegl_node_add_child (gegl, operation);
gegl_node_link_many (input, operation, output, NULL);
@@ -94,7 +91,9 @@
g_object_unref (processor);
- gimp_drawable_merge_shadow (drawable, TRUE, undo_desc);
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE, undo_desc);
+ gimp_drawable_free_shadow_tiles (drawable);
+
gimp_drawable_update (drawable, rect.x, rect.y, rect.width, rect.height);
if (progress)
Modified: trunk/app/core/gimpdrawable-posterize.c
==============================================================================
--- trunk/app/core/gimpdrawable-posterize.c (original)
+++ trunk/app/core/gimpdrawable-posterize.c Mon Apr 21 17:20:51 2008
@@ -36,6 +36,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-operation.h"
#include "gimpdrawable-posterize.h"
+#include "gimpdrawable-shadow.h"
#include "gimp-intl.h"
@@ -96,7 +97,9 @@
gimp_lut_free (lut);
- gimp_drawable_merge_shadow (drawable, TRUE, _("Posterize"));
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Posterize"));
+ gimp_drawable_free_shadow_tiles (drawable);
+
gimp_drawable_update (drawable, x, y, width, height);
}
}
Added: trunk/app/core/gimpdrawable-shadow.c
==============================================================================
--- (empty file)
+++ trunk/app/core/gimpdrawable-shadow.c Mon Apr 21 17:20:51 2008
@@ -0,0 +1,104 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+
+#include "core-types.h"
+
+#include "base/pixel-region.h"
+#include "base/tile-manager.h"
+
+#include "gimpdrawable.h"
+#include "gimpdrawable-shadow.h"
+#include "gimpimage.h"
+
+
+TileManager *
+gimp_drawable_get_shadow_tiles (GimpDrawable *drawable)
+{
+ GimpItem *item;
+
+ g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
+
+ item = GIMP_ITEM (drawable);
+
+ g_return_val_if_fail (gimp_item_is_attached (item), NULL);
+
+ if (drawable->shadow)
+ {
+ if ((gimp_item_width (item) != tile_manager_width (drawable->shadow)) ||
+ (gimp_item_height (item) != tile_manager_height (drawable->shadow)) ||
+ (drawable->bytes != tile_manager_bpp (drawable->shadow)))
+ {
+ gimp_drawable_free_shadow_tiles (drawable);
+ }
+ else
+ {
+ return drawable->shadow;
+ }
+ }
+
+ drawable->shadow = tile_manager_new (gimp_item_width (item),
+ gimp_item_height (item),
+ drawable->bytes);
+
+ return drawable->shadow;
+}
+
+void
+gimp_drawable_free_shadow_tiles (GimpDrawable *drawable)
+{
+ g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+
+ if (drawable->shadow)
+ {
+ tile_manager_unref (drawable->shadow);
+ drawable->shadow = NULL;
+ }
+}
+
+void
+gimp_drawable_merge_shadow_tiles (GimpDrawable *drawable,
+ gboolean push_undo,
+ const gchar *undo_desc)
+{
+ gint x, y;
+ gint width, height;
+
+ g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
+ g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
+ g_return_if_fail (drawable->shadow != NULL);
+
+ /* A useful optimization here is to limit the update to the
+ * extents of the selection mask, as it cannot extend beyond
+ * them.
+ */
+ if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
+ {
+ PixelRegion shadowPR;
+
+ pixel_region_init (&shadowPR, drawable->shadow,
+ x, y, width, height, FALSE);
+ gimp_drawable_apply_region (drawable, &shadowPR,
+ push_undo, undo_desc,
+ GIMP_OPACITY_OPAQUE, GIMP_REPLACE_MODE,
+ NULL, x, y);
+ }
+}
Added: trunk/app/core/gimpdrawable-shadow.h
==============================================================================
--- (empty file)
+++ trunk/app/core/gimpdrawable-shadow.h Mon Apr 21 17:20:51 2008
@@ -0,0 +1,33 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpdrawable-shadow.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GIMP_DRAWABLE_SHADOW_H__
+#define __GIMP_DRAWABLE_SHADOW_H__
+
+
+TileManager * gimp_drawable_get_shadow_tiles (GimpDrawable *drawable);
+void gimp_drawable_free_shadow_tiles (GimpDrawable *drawable);
+
+void gimp_drawable_merge_shadow_tiles (GimpDrawable *drawable,
+ gboolean push_undo,
+ const gchar *undo_desc);
+
+
+#endif /* __GIMP_DRAWABLE_SHADOW_H__ */
Modified: trunk/app/core/gimpdrawable-threshold.c
==============================================================================
--- trunk/app/core/gimpdrawable-threshold.c (original)
+++ trunk/app/core/gimpdrawable-threshold.c Mon Apr 21 17:20:51 2008
@@ -35,6 +35,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-operation.h"
#include "gimpdrawable-threshold.h"
+#include "gimpdrawable-shadow.h"
#include "gimp-intl.h"
@@ -95,7 +96,9 @@
pixel_regions_process_parallel ((PixelProcessorFunc) threshold,
&cruft, 2, &srcPR, &destPR);
- gimp_drawable_merge_shadow (drawable, TRUE, _("Threshold"));
+ gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Threshold"));
+ gimp_drawable_free_shadow_tiles (drawable);
+
gimp_drawable_update (drawable, x, y, width, height);
}
}
Modified: trunk/app/core/gimpdrawable.c
==============================================================================
--- trunk/app/core/gimpdrawable.c (original)
+++ trunk/app/core/gimpdrawable.c Mon Apr 21 17:20:51 2008
@@ -37,6 +37,7 @@
#include "gimpcontext.h"
#include "gimpdrawable-combine.h"
#include "gimpdrawable-preview.h"
+#include "gimpdrawable-shadow.h"
#include "gimpdrawable-transform.h"
#include "gimpimage.h"
#include "gimpimage-colormap.h"
@@ -74,6 +75,7 @@
gint *height);
static void gimp_drawable_invalidate_preview (GimpViewable *viewable);
+static void gimp_drawable_removed (GimpItem *item);
static GimpItem * gimp_drawable_duplicate (GimpItem *item,
GType new_type);
static void gimp_drawable_translate (GimpItem *item,
@@ -200,6 +202,7 @@
viewable_class->invalidate_preview = gimp_drawable_invalidate_preview;
viewable_class->get_preview = gimp_drawable_get_preview;
+ item_class->removed = gimp_drawable_removed;
item_class->duplicate = gimp_drawable_duplicate;
item_class->translate = gimp_drawable_translate;
item_class->scale = gimp_drawable_scale;
@@ -225,6 +228,7 @@
gimp_drawable_init (GimpDrawable *drawable)
{
drawable->tiles = NULL;
+ drawable->shadow = NULL;
drawable->bytes = 0;
drawable->type = -1;
drawable->has_alpha = FALSE;
@@ -255,6 +259,8 @@
drawable->tiles = NULL;
}
+ gimp_drawable_free_shadow_tiles (drawable);
+
if (drawable->preview_cache)
gimp_preview_cache_invalidate (&drawable->preview_cache);
@@ -270,6 +276,7 @@
memsize += tile_manager_get_memsize (gimp_drawable_get_tiles (drawable),
FALSE);
+ memsize += tile_manager_get_memsize (drawable->shadow, FALSE);
*gui_size += gimp_preview_cache_get_memsize (drawable->preview_cache);
@@ -304,6 +311,17 @@
gimp_preview_cache_invalidate (&drawable->preview_cache);
}
+static void
+gimp_drawable_removed (GimpItem *item)
+{
+ GimpDrawable *drawable = GIMP_DRAWABLE (item);
+
+ gimp_drawable_free_shadow_tiles (drawable);
+
+ if (GIMP_ITEM_CLASS (parent_class)->removed)
+ GIMP_ITEM_CLASS (parent_class)->removed (item);
+}
+
static GimpItem *
gimp_drawable_duplicate (GimpItem *item,
GType new_type)
@@ -1056,55 +1074,6 @@
x, y, width, height);
}
-TileManager *
-gimp_drawable_get_shadow_tiles (GimpDrawable *drawable)
-{
- GimpItem *item;
-
- g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
-
- item = GIMP_ITEM (drawable);
-
- g_return_val_if_fail (gimp_item_is_attached (item), NULL);
-
- return gimp_image_get_shadow_tiles (gimp_item_get_image (item),
- gimp_item_width (item),
- gimp_item_height (item),
- drawable->bytes);
-}
-
-void
-gimp_drawable_merge_shadow (GimpDrawable *drawable,
- gboolean push_undo,
- const gchar *undo_desc)
-{
- GimpImage *image;
- gint x, y, width, height;
-
- g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
- g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
-
- image = gimp_item_get_image (GIMP_ITEM (drawable));
-
- g_return_if_fail (image->shadow != NULL);
-
- /* A useful optimization here is to limit the update to the
- * extents of the selection mask, as it cannot extend beyond
- * them.
- */
- if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
- {
- PixelRegion shadowPR;
-
- pixel_region_init (&shadowPR, image->shadow,
- x, y, width, height, FALSE);
- gimp_drawable_apply_region (drawable, &shadowPR,
- push_undo, undo_desc,
- GIMP_OPACITY_OPAQUE, GIMP_REPLACE_MODE,
- NULL, x, y);
- }
-}
-
void
gimp_drawable_fill (GimpDrawable *drawable,
const GimpRGB *color,
Modified: trunk/app/core/gimpdrawable.h
==============================================================================
--- trunk/app/core/gimpdrawable.h (original)
+++ trunk/app/core/gimpdrawable.h Mon Apr 21 17:20:51 2008
@@ -38,6 +38,7 @@
GimpItem parent_instance;
TileManager *tiles; /* tiles for drawable data */
+ TileManager *shadow; /* shadow buffer tiles */
gint bytes; /* bytes per pixel */
GimpImageType type; /* type of drawable */
@@ -185,11 +186,6 @@
TileManager *tiles,
gboolean sparse);
-TileManager * gimp_drawable_get_shadow_tiles (GimpDrawable *drawable);
-void gimp_drawable_merge_shadow (GimpDrawable *drawable,
- gboolean push_undo,
- const gchar *undo_desc);
-
void gimp_drawable_fill (GimpDrawable *drawable,
const GimpRGB *color,
const GimpPattern *pattern);
Modified: trunk/app/core/gimpimage.c
==============================================================================
--- trunk/app/core/gimpimage.c (original)
+++ trunk/app/core/gimpimage.c Mon Apr 21 17:20:51 2008
@@ -31,7 +31,6 @@
#include "core-types.h"
#include "base/temp-buf.h"
-#include "base/tile-manager.h"
#include "config/gimpcoreconfig.h"
@@ -588,8 +587,6 @@
image->tattoo_state = 0;
- image->shadow = NULL;
-
image->projection = gimp_projection_new (image);
image->guides = NULL;
@@ -869,9 +866,6 @@
image->projection = NULL;
}
- if (image->shadow)
- gimp_image_free_shadow_tiles (image);
-
if (image->colormap)
{
g_free (image->colormap);
@@ -986,8 +980,6 @@
if (gimp_image_get_colormap (image))
memsize += GIMP_IMAGE_COLORMAP_SIZE;
- memsize += tile_manager_get_memsize (image->shadow, FALSE);
-
memsize += gimp_object_get_memsize (GIMP_OBJECT (image->projection),
gui_size);
@@ -2263,48 +2255,6 @@
}
-/* shadow tiles */
-
-TileManager *
-gimp_image_get_shadow_tiles (GimpImage *image,
- gint width,
- gint height,
- gint bpp)
-{
- g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
-
- if (image->shadow)
- {
- if ((width != tile_manager_width (image->shadow)) ||
- (height != tile_manager_height (image->shadow)) ||
- (bpp != tile_manager_bpp (image->shadow)))
- {
- gimp_image_free_shadow_tiles (image);
- }
- else
- {
- return image->shadow;
- }
- }
-
- image->shadow = tile_manager_new (width, height, bpp);
-
- return image->shadow;
-}
-
-void
-gimp_image_free_shadow_tiles (GimpImage *image)
-{
- g_return_if_fail (GIMP_IS_IMAGE (image));
-
- if (image->shadow)
- {
- tile_manager_unref (image->shadow);
- image->shadow = NULL;
- }
-}
-
-
/* parasites */
const GimpParasite *
Modified: trunk/app/core/gimpimage.h
==============================================================================
--- trunk/app/core/gimpimage.h (original)
+++ trunk/app/core/gimpimage.h Mon Apr 21 17:20:51 2008
@@ -125,8 +125,6 @@
GimpTattoo tattoo_state; /* the last used tattoo */
- TileManager *shadow; /* shadow buffer tiles */
-
GimpProjection *projection; /* projection layers & channels */
GList *guides; /* guides */
@@ -379,15 +377,6 @@
gboolean *new_buf);
-/* shadow tiles */
-
-TileManager * gimp_image_get_shadow_tiles (GimpImage *image,
- gint width,
- gint height,
- gint bpp);
-void gimp_image_free_shadow_tiles (GimpImage *image);
-
-
/* parasites */
const GimpParasite * gimp_image_parasite_find (const GimpImage *image,
Modified: trunk/app/core/gimpimagemap.c
==============================================================================
--- trunk/app/core/gimpimagemap.c (original)
+++ trunk/app/core/gimpimagemap.c Mon Apr 21 17:20:51 2008
@@ -30,6 +30,7 @@
#include "paint-funcs/paint-funcs.h"
#include "gimpdrawable.h"
+#include "gimpdrawable-shadow.h"
#include "gimpimage.h"
#include "gimpimagemap.h"
#include "gimpmarshal.h"
@@ -216,6 +217,8 @@
if (image_map->drawable)
{
+ gimp_drawable_free_shadow_tiles (image_map->drawable);
+
g_object_unref (image_map->drawable);
image_map->drawable = NULL;
}
@@ -687,8 +690,6 @@
static gboolean
gimp_image_map_do (GimpImageMap *image_map)
{
- GimpImage *image;
-
if (! gimp_item_is_attached (GIMP_ITEM (image_map->drawable)))
{
image_map->idle_id = 0;
@@ -708,8 +709,6 @@
return FALSE;
}
- image = gimp_item_get_image (GIMP_ITEM (image_map->drawable));
-
if (image_map->gegl)
{
if (! gegl_processor_work (image_map->processor, NULL))
@@ -758,7 +757,9 @@
&image_map->destPR);
- pixel_region_init (&srcPR, image->shadow, x, y, w, h, FALSE);
+ pixel_region_init (&srcPR,
+ gimp_drawable_get_shadow_tiles (image_map->drawable),
+ x, y, w, h, FALSE);
gimp_drawable_apply_region (image_map->drawable, &srcPR,
FALSE, NULL,
@@ -791,17 +792,14 @@
const GeglRectangle *extent,
GimpImageMap *image_map)
{
- GimpImage *image;
- PixelRegion srcPR;
- PixelRegion destPR;
+ PixelRegion srcPR;
+ PixelRegion destPR;
#if 0
g_print ("%s: rect = { %d, %d, %d, %d }\n",
G_STRFUNC, extent->x, extent->y, extent->width, extent->height);
#endif
- image = gimp_item_get_image (GIMP_ITEM (image_map->drawable));
-
/* Reset to initial drawable conditions. */
pixel_region_init (&srcPR, image_map->undo_tiles,
extent->x - image_map->undo_offset_x,
@@ -818,7 +816,8 @@
copy_region (&srcPR, &destPR);
/* Apply the result of the gegl graph. */
- pixel_region_init (&srcPR, image->shadow,
+ pixel_region_init (&srcPR,
+ gimp_drawable_get_shadow_tiles (image_map->drawable),
extent->x,
extent->y,
extent->width,
Modified: trunk/app/pdb/drawable-cmds.c
==============================================================================
--- trunk/app/pdb/drawable-cmds.c (original)
+++ trunk/app/pdb/drawable-cmds.c Mon Apr 21 17:20:51 2008
@@ -32,11 +32,13 @@
#include "core/gimpdrawable-foreground-extract.h"
#include "core/gimpdrawable-offset.h"
#include "core/gimpdrawable-preview.h"
+#include "core/gimpdrawable-shadow.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimpparamspecs.h"
+#include "plug-in/gimpplugin-cleanup.h"
#include "plug-in/gimpplugin.h"
#include "plug-in/gimppluginmanager.h"
#include "text/gimptextlayer.h"
@@ -851,7 +853,7 @@
if (gimp->plug_in_manager->current_plug_in)
undo_desc = gimp_plug_in_get_undo_desc (gimp->plug_in_manager->current_plug_in);
- gimp_drawable_merge_shadow (drawable, undo, undo_desc);
+ gimp_drawable_merge_shadow_tiles (drawable, undo, undo_desc);
}
else
success = FALSE;
@@ -861,6 +863,31 @@
}
static GValueArray *
+drawable_free_shadow_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpDrawable *drawable;
+
+ drawable = gimp_value_get_drawable (&args->values[0], gimp);
+
+ if (success)
+ {
+ if (gimp->plug_in_manager->current_plug_in)
+ gimp_plug_in_cleanup_remove_shadow (gimp->plug_in_manager->current_plug_in,
+ drawable);
+
+ gimp_drawable_free_shadow_tiles (drawable);
+ }
+
+ return gimp_procedure_get_return_values (procedure, success);
+}
+
+static GValueArray *
drawable_update_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -2128,7 +2155,7 @@
gimp_procedure_set_static_strings (procedure,
"gimp-drawable-merge-shadow",
"Merge the shadow buffer with the specified drawable.",
- "This procedure combines the contents of the image's shadow buffer (for temporary processing) with the specified drawable. The 'undo' parameter specifies whether to add an undo step for the operation. Requesting no undo is useful for such applications as 'auto-apply'.",
+ "This procedure combines the contents of the drawable's shadow buffer (for temporary processing) with the specified drawable. The 'undo' parameter specifies whether to add an undo step for the operation. Requesting no undo is useful for such applications as 'auto-apply'.",
"Spencer Kimball & Peter Mattis",
"Spencer Kimball & Peter Mattis",
"1995-1996",
@@ -2149,6 +2176,29 @@
g_object_unref (procedure);
/*
+ * gimp-drawable-free-shadow
+ */
+ procedure = gimp_procedure_new (drawable_free_shadow_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-drawable-free-shadow");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-drawable-free-shadow",
+ "Free the specified drawable's shadow data (if it exists).",
+ "This procedure is intended as a memory saving device. If any shadow memory has been allocated, it will be freed automatically when the drawable is removed from the image, or when the plug-in procedure which allocated it returns.",
+ "Michael Natterer <mitch gimp org>",
+ "Michael Natterer",
+ "2008",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_drawable_id ("drawable",
+ "drawable",
+ "The drawable",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-drawable-update
*/
procedure = gimp_procedure_new (drawable_update_invoker);
Modified: trunk/app/pdb/image-cmds.c
==============================================================================
--- trunk/app/pdb/image-cmds.c (original)
+++ trunk/app/pdb/image-cmds.c Mon Apr 21 17:20:51 2008
@@ -316,7 +316,6 @@
if (success)
{
- gimp_image_free_shadow_tiles (image);
}
return gimp_procedure_get_return_values (procedure, success);
@@ -2595,12 +2594,12 @@
"gimp-image-free-shadow");
gimp_procedure_set_static_strings (procedure,
"gimp-image-free-shadow",
- "Free the specified image's shadow data (if it exists).",
- "This procedure is intended as a memory saving device. If any shadow memory has been allocated, it will be freed automatically on a call to 'gimp-image-delete'.",
- "Spencer Kimball & Peter Mattis",
- "Spencer Kimball & Peter Mattis",
- "1995-1996",
- NULL);
+ "This procedure is deprecated! Use 'gimp-drawable-free-shadow' instead.",
+ "This procedure is deprecated! Use 'gimp-drawable-free-shadow' instead.",
+ "",
+ "",
+ "",
+ "gimp-drawable-free-shadow");
gimp_procedure_add_argument (procedure,
gimp_param_spec_image_id ("image",
"image",
Modified: trunk/app/pdb/internal-procs.c
==============================================================================
--- trunk/app/pdb/internal-procs.c (original)
+++ trunk/app/pdb/internal-procs.c Mon Apr 21 17:20:51 2008
@@ -29,7 +29,7 @@
#include "internal-procs.h"
-/* 584 procedures registered total */
+/* 585 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
Modified: trunk/app/plug-in/gimpplugin-cleanup.c
==============================================================================
--- trunk/app/plug-in/gimpplugin-cleanup.c (original)
+++ trunk/app/plug-in/gimpplugin-cleanup.c Mon Apr 21 17:20:51 2008
@@ -26,9 +26,10 @@
#include "core/gimp.h"
#include "core/gimpcontainer.h"
+#include "core/gimpdrawable.h"
+#include "core/gimpdrawable-shadow.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
-#include "core/gimpitem.h"
#include "core/gimpundostack.h"
#include "gimpplugin.h"
@@ -54,6 +55,8 @@
{
GimpItem *item;
gint item_ID;
+
+ gboolean shadow_tiles;
};
@@ -128,6 +131,58 @@
return TRUE;
}
+gboolean
+gimp_plug_in_cleanup_add_shadow (GimpPlugIn *plug_in,
+ GimpDrawable *drawable)
+{
+ GimpPlugInProcFrame *proc_frame;
+ GimpPlugInCleanupItem *cleanup;
+
+ g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
+ g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
+
+ proc_frame = gimp_plug_in_get_proc_frame (plug_in);
+ cleanup = gimp_plug_in_cleanup_item_get (proc_frame, GIMP_ITEM (drawable));
+
+ if (! cleanup)
+ {
+ cleanup = gimp_plug_in_cleanup_item_new (GIMP_ITEM (drawable));
+
+ proc_frame->item_cleanups = g_list_prepend (proc_frame->item_cleanups,
+ cleanup);
+ }
+
+ cleanup->shadow_tiles = TRUE;
+
+ return TRUE;
+}
+
+gboolean
+gimp_plug_in_cleanup_remove_shadow (GimpPlugIn *plug_in,
+ GimpDrawable *drawable)
+{
+ GimpPlugInProcFrame *proc_frame;
+ GimpPlugInCleanupItem *cleanup;
+
+ g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), FALSE);
+ g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
+
+ proc_frame = gimp_plug_in_get_proc_frame (plug_in);
+ cleanup = gimp_plug_in_cleanup_item_get (proc_frame, GIMP_ITEM (drawable));
+
+ if (! cleanup)
+ return FALSE;
+
+ if (! cleanup->shadow_tiles)
+ return FALSE;
+
+ proc_frame->item_cleanups = g_list_remove (proc_frame->item_cleanups,
+ cleanup);
+ gimp_plug_in_cleanup_item_free (cleanup);
+
+ return TRUE;
+}
+
void
gimp_plug_in_cleanup (GimpPlugIn *plug_in,
GimpPlugInProcFrame *proc_frame)
@@ -181,6 +236,17 @@
cleanup->item_ID) != item)
goto free_item_cleanup;
+ if (cleanup->shadow_tiles)
+ {
+ GimpProcedure *proc = proc_frame->procedure;
+
+ g_printerr ("Plug-In '%s' didn't free shadow tiles of drawable '%s'.\n",
+ gimp_plug_in_procedure_get_label (GIMP_PLUG_IN_PROCEDURE (proc)),
+ gimp_object_get_name (GIMP_OBJECT (item)));
+
+ gimp_drawable_free_shadow_tiles (GIMP_DRAWABLE (item));
+ }
+
free_item_cleanup:
gimp_plug_in_cleanup_item_free (cleanup);
}
Modified: trunk/app/plug-in/gimpplugin-cleanup.h
==============================================================================
--- trunk/app/plug-in/gimpplugin-cleanup.h (original)
+++ trunk/app/plug-in/gimpplugin-cleanup.h Mon Apr 21 17:20:51 2008
@@ -27,6 +27,11 @@
gboolean gimp_plug_in_cleanup_undo_group_end (GimpPlugIn *plug_in,
GimpImage *image);
+gboolean gimp_plug_in_cleanup_add_shadow (GimpPlugIn *plug_in,
+ GimpDrawable *drawable);
+gboolean gimp_plug_in_cleanup_remove_shadow (GimpPlugIn *plug_in,
+ GimpDrawable *drawable);
+
void gimp_plug_in_cleanup (GimpPlugIn *plug_in,
GimpPlugInProcFrame *proc_frame);
Modified: trunk/app/plug-in/gimpplugin-message.c
==============================================================================
--- trunk/app/plug-in/gimpplugin-message.c (original)
+++ trunk/app/plug-in/gimpplugin-message.c Mon Apr 21 17:20:51 2008
@@ -35,11 +35,13 @@
#include "core/gimp.h"
#include "core/gimpdrawable.h"
+#include "core/gimpdrawable-shadow.h"
#include "pdb/gimppdb.h"
#include "pdb/gimp-pdb-compat.h"
#include "gimpplugin.h"
+#include "gimpplugin-cleanup.h"
#include "gimpplugin-message.h"
#include "gimppluginmanager.h"
#include "gimpplugindef.h"
@@ -244,9 +246,15 @@
}
if (tile_info->shadow)
- tm = gimp_drawable_get_shadow_tiles (drawable);
+ {
+ tm = gimp_drawable_get_shadow_tiles (drawable);
+
+ gimp_plug_in_cleanup_add_shadow (plug_in, drawable);
+ }
else
- tm = gimp_drawable_get_tiles (drawable);
+ {
+ tm = gimp_drawable_get_tiles (drawable);
+ }
tile = tile_manager_get (tm, tile_info->tile_num, TRUE, TRUE);
@@ -313,9 +321,15 @@
}
if (request->shadow)
- tm = gimp_drawable_get_shadow_tiles (drawable);
+ {
+ tm = gimp_drawable_get_shadow_tiles (drawable);
+
+ gimp_plug_in_cleanup_add_shadow (plug_in, drawable);
+ }
else
- tm = gimp_drawable_get_tiles (drawable);
+ {
+ tm = gimp_drawable_get_tiles (drawable);
+ }
tile = tile_manager_get (tm, request->tile_num, TRUE, FALSE);
Modified: trunk/libgimp/gimpdrawable_pdb.c
==============================================================================
--- trunk/libgimp/gimpdrawable_pdb.c (original)
+++ trunk/libgimp/gimpdrawable_pdb.c Mon Apr 21 17:20:51 2008
@@ -971,7 +971,7 @@
*
* Merge the shadow buffer with the specified drawable.
*
- * This procedure combines the contents of the image's shadow buffer
+ * This procedure combines the contents of the drawable's shadow buffer
* (for temporary processing) with the specified drawable. The 'undo'
* parameter specifies whether to add an undo step for the operation.
* Requesting no undo is useful for such applications as 'auto-apply'.
@@ -1000,6 +1000,40 @@
}
/**
+ * gimp_drawable_free_shadow:
+ * @drawable_ID: The drawable.
+ *
+ * Free the specified drawable's shadow data (if it exists).
+ *
+ * This procedure is intended as a memory saving device. If any shadow
+ * memory has been allocated, it will be freed automatically when the
+ * drawable is removed from the image, or when the plug-in procedure
+ * which allocated it returns.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: GIMP 2.6
+ */
+gboolean
+gimp_drawable_free_shadow (gint32 drawable_ID)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-drawable-free-shadow",
+ &nreturn_vals,
+ GIMP_PDB_DRAWABLE, drawable_ID,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
+
+/**
* gimp_drawable_update:
* @drawable_ID: The drawable.
* @x: x coordinate of upper left corner of update region.
Modified: trunk/libgimp/gimpdrawable_pdb.h
==============================================================================
--- trunk/libgimp/gimpdrawable_pdb.h (original)
+++ trunk/libgimp/gimpdrawable_pdb.h Mon Apr 21 17:20:51 2008
@@ -76,6 +76,7 @@
gint *height);
gboolean gimp_drawable_merge_shadow (gint32 drawable_ID,
gboolean undo);
+gboolean gimp_drawable_free_shadow (gint32 drawable_ID);
gboolean gimp_drawable_update (gint32 drawable_ID,
gint x,
gint y,
Modified: trunk/libgimp/gimpimage_pdb.c
==============================================================================
--- trunk/libgimp/gimpimage_pdb.c (original)
+++ trunk/libgimp/gimpimage_pdb.c Mon Apr 21 17:20:51 2008
@@ -26,6 +26,9 @@
#include <string.h>
#include "gimp.h"
+#undef GIMP_DISABLE_DEPRECATED
+#undef __GIMP_IMAGE_PDB_H__
+#include "gimpimage_pdb.h"
/**
* gimp_image_is_valid:
@@ -300,11 +303,8 @@
* gimp_image_free_shadow:
* @image_ID: The image.
*
- * Free the specified image's shadow data (if it exists).
- *
- * This procedure is intended as a memory saving device. If any shadow
- * memory has been allocated, it will be freed automatically on a call
- * to gimp_image_delete().
+ * This procedure is deprecated! Use gimp_drawable_free_shadow()
+ * instead.
*
* Returns: TRUE on success.
*/
Modified: trunk/libgimp/gimpimage_pdb.h
==============================================================================
--- trunk/libgimp/gimpimage_pdb.h (original)
+++ trunk/libgimp/gimpimage_pdb.h Mon Apr 21 17:20:51 2008
@@ -39,7 +39,9 @@
GimpImageBaseType gimp_image_base_type (gint32 image_ID);
gint gimp_image_width (gint32 image_ID);
gint gimp_image_height (gint32 image_ID);
+#ifndef GIMP_DISABLE_DEPRECATED
gboolean gimp_image_free_shadow (gint32 image_ID);
+#endif /* GIMP_DISABLE_DEPRECATED */
gboolean gimp_image_resize (gint32 image_ID,
gint new_width,
gint new_height,
Modified: trunk/tools/pdbgen/pdb/drawable.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/drawable.pdb (original)
+++ trunk/tools/pdbgen/pdb/drawable.pdb Mon Apr 21 17:20:51 2008
@@ -51,8 +51,8 @@
$blurb = 'Merge the shadow buffer with the specified drawable.';
$help = <<'HELP';
-This procedure combines the contents of the image's shadow buffer (for
-temporary processing) with the specified drawable. The 'undo'
+This procedure combines the contents of the drawable's shadow buffer
+(for temporary processing) with the specified drawable. The 'undo'
parameter specifies whether to add an undo step for the operation.
Requesting no undo is useful for such applications as 'auto-apply'.
HELP
@@ -67,7 +67,9 @@
);
%invoke = (
- headers => [ qw("plug-in/gimpplugin.h" "plug-in/gimppluginmanager.h") ],
+ headers => [ qw("core/gimpdrawable-shadow.h"
+ "plug-in/gimpplugin.h"
+ "plug-in/gimppluginmanager.h") ],
code => <<'CODE'
{
if (gimp_pdb_item_is_attached (GIMP_ITEM (drawable), error))
@@ -77,7 +79,7 @@
if (gimp->plug_in_manager->current_plug_in)
undo_desc = gimp_plug_in_get_undo_desc (gimp->plug_in_manager->current_plug_in);
- gimp_drawable_merge_shadow (drawable, undo, undo_desc);
+ gimp_drawable_merge_shadow_tiles (drawable, undo, undo_desc);
}
else
success = FALSE;
@@ -86,6 +88,37 @@
);
}
+sub drawable_free_shadow {
+ $blurb = "Free the specified drawable's shadow data (if it exists).";
+
+ $help = <<'HELP';
+This procedure is intended as a memory saving device. If any shadow
+memory has been allocated, it will be freed automatically when the
+drawable is removed from the image, or when the plug-in procedure
+which allocated it returns.
+HELP
+
+ &mitch_pdb_misc('2008', '2.6');
+
+ @inargs = (
+ { name => 'drawable', type => 'drawable',
+ desc => 'The drawable' }
+ );
+
+ %invoke = (
+ headers => [ qw("plug-in/gimpplugin-cleanup.h") ],
+ code => <<'CODE'
+{
+ if (gimp->plug_in_manager->current_plug_in)
+ gimp_plug_in_cleanup_remove_shadow (gimp->plug_in_manager->current_plug_in,
+ drawable);
+
+ gimp_drawable_free_shadow_tiles (drawable);
+}
+CODE
+ );
+}
+
sub drawable_fill {
$blurb = 'Fill the drawable with the specified fill mode.';
@@ -1322,6 +1355,7 @@
drawable_mask_bounds
drawable_mask_intersect
drawable_merge_shadow
+ drawable_free_shadow
drawable_update
drawable_get_pixel drawable_set_pixel
drawable_fill
Modified: trunk/tools/pdbgen/pdb/image.pdb
==============================================================================
--- trunk/tools/pdbgen/pdb/image.pdb (original)
+++ trunk/tools/pdbgen/pdb/image.pdb Mon Apr 21 17:20:51 2008
@@ -385,15 +385,7 @@
}
sub image_free_shadow {
- $blurb = "Free the specified image's shadow data (if it exists).";
-
- $help = <<'HELP';
-This procedure is intended as a memory saving device. If any shadow memory has
-been allocated, it will be freed automatically on a call to
-gimp_image_delete().
-HELP
-
- &std_pdb_misc;
+ &std_pdb_deprecated ('gimp-drawable-free-shadow');
@inargs = (
{ name => 'image', type => 'image',
@@ -403,7 +395,6 @@
%invoke = (
code => <<'CODE'
{
- gimp_image_free_shadow_tiles (image);
}
CODE
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]