Commit e5be5664 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Move the shadow tiles from the image to the drawable. Fixes bug #100469.

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.


svn path=/trunk/; revision=25510
parent fb803965
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.
2008-04-21 Sven Neumann <sven@gimp.org>
* plug-ins/common/psp.c: applied patch from Christoph Brill which
......
......@@ -143,6 +143,8 @@ libappcore_a_sources = \
gimpdrawable-posterize.h \
gimpdrawable-preview.c \
gimpdrawable-preview.h \
gimpdrawable-shadow.c \
gimpdrawable-shadow.h \
gimpdrawable-stroke.c \
gimpdrawable-stroke.h \
gimpdrawable-threshold.c \
......
......@@ -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_drawable_brightness_contrast (GimpDrawable *drawable,
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);
}
}
......
......@@ -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 @@ gimp_drawable_color_balance (GimpDrawable *drawable,
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);
}
}
......
......@@ -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 @@ gimp_drawable_colorize (GimpDrawable *drawable,
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);
}
}
......
......@@ -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_drawable_curves (GimpDrawable *drawable,
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);
}
}
......
......@@ -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 @@ gimp_drawable_desaturate (GimpDrawable *drawable,
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);
}
......
......@@ -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_drawable_equalize (GimpDrawable *drawable,
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);
}
......@@ -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 @@ gimp_drawable_hue_saturation (GimpDrawable *drawable,
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);
}
}
......
......@@ -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_drawable_invert (GimpDrawable *drawable,
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);
}
......
......@@ -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_drawable_levels_internal (GimpDrawable *drawable,
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);
}
......
......@@ -29,6 +29,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-operation.h"
#include "gimpdrawable-shadow.h"
#include "gimpprogress.h"
#ifdef __GNUC__
......@@ -75,10 +76,6 @@ gimp_drawable_apply_operation (GimpDrawable *drawable,
"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 @@ gimp_drawable_apply_operation (GimpDrawable *drawable,
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)
......
......@@ -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_drawable_posterize (GimpDrawable *drawable,
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);
}
}
......
/* 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);
}
}
/* 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__ */
......@@ -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 @@ gimp_drawable_threshold (GimpDrawable *drawable,
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);
}
}
......
......@@ -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 @@ static gboolean gimp_drawable_get_size (GimpViewable *viewable,
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 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
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 @@ static void
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 @@ gimp_drawable_finalize (GObject *object)
drawable->tiles = NULL;
}
gimp_drawable_free_shadow_tiles (drawable);
if (drawable->preview_cache)
gimp_preview_cache_invalidate (&drawable->preview_cache);
......@@ -270,6 +276,7 @@ gimp_drawable_get_memsize (GimpObject *object,
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_drawable_invalidate_preview (GimpViewable *viewable)
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 @@ gimp_drawable_push_undo (GimpDrawable *drawable,
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,
......
......@@ -38,6 +38,7 @@ struct _GimpDrawable
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 @@ void gimp_drawable_push_undo (GimpDrawable *drawable,
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);
......
......@@ -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 @@ gimp_image_init (GimpImage *image)
image->tattoo_state = 0;
image->shadow = NULL;
image->projection = gimp_projection_new (image);
image->guides = NULL;
......@@ -869,9 +866,6 @@ gimp_image_finalize (GObject *object)
image->projection = NULL;
}
if (image->shadow)
gimp_image_free_shadow_tiles (image);
if (image->colormap)
{
g_free (image->colormap);
......@@ -986,8 +980,6 @@ gimp_image_get_memsize (GimpObject *object,
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 @@ gimp_image_transform_temp_buf (const GimpImage *dest_image,
}
/* 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 *
......
......@@ -125,8 +125,6 @@ struct _GimpImage
GimpTattoo tattoo_state; /* the last used tattoo */
TileManager *shadow; /* shadow buffer tiles */
GimpProjection *projection; /* projection layers & channels */
GList *guides; /* guides */
......@@ -379,15 +377,6 @@ TempBuf * gimp_image_transform_temp_buf (const GimpImage *dest_image
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,
......
......@@ -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 @@ gimp_image_map_finalize (GObject *object)
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 @@ gimp_image_map_abort (GimpImageMap *image_map)
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 @@ gimp_image_map_do (GimpImageMap *image_map)
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 @@ gimp_image_map_do (GimpImageMap *image_map)
&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,
...