mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-20 19:43:01 +00:00
Bye bye floating_sel_rigor() and floating_sel_relax():
2008-11-09 Michael Natterer <mitch@gimp.org> Bye bye floating_sel_rigor() and floating_sel_relax(): * app/core/gimpdrawable.[ch] (gimp_drawable_init_src_region): implement compositing the floating selection on the fly. Add return parameter "TileManager **temp_tiles" which returns the temp buffer used for compositing; the caller has to unref the tiles. * app/core/gimpchannel-project.c * app/core/gimplayer-project.c: unref the temp_tiles. * app/core/gimplayer.[ch]: remove members fs.backing_store and fs.initial. * app/core/gimplayer-floating-sel.[ch]: remove functions rigor(), relax(), store() and restore(), they are not needed any longer. Some minor cleanup, more to come. * app/core/gimpprojection-construct.c: don't composite the floating selection before projecting because that happens on the fly now. * app/core/core-enums.[ch] * app/core/gimpfloatingselundo.c * app/core/gimpimage-undo-push.[ch]: remove the rigor and relax undos. * app/core/gimpdrawable.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/core/gimplayer.c * app/xcf/xcf-save.c: remove all calls to rigor and relax and all implementations of virtual functions that were just there to rigor/releax around chaining up. * tools/pdbgen/pdb/floating_sel.pdb: remove all code from the rigor and relax wrappers and deprecate the API. * app/pdb/floating-sel-cmds.c * libgimp/gimpfloatingsel_pdb.[ch]: regenerated. * plug-ins/file-xjt/xjt.c: don't call rigor and relax. svn path=/trunk/; revision=27579
This commit is contained in:
parent
b2379f44b3
commit
855b114f50
45
ChangeLog
45
ChangeLog
|
@ -1,3 +1,48 @@
|
|||
2008-11-09 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Bye bye floating_sel_rigor() and floating_sel_relax():
|
||||
|
||||
* app/core/gimpdrawable.[ch] (gimp_drawable_init_src_region):
|
||||
implement compositing the floating selection on the fly. Add
|
||||
return parameter "TileManager **temp_tiles" which returns the temp
|
||||
buffer used for compositing; the caller has to unref the tiles.
|
||||
|
||||
* app/core/gimpchannel-project.c
|
||||
* app/core/gimplayer-project.c: unref the temp_tiles.
|
||||
|
||||
* app/core/gimplayer.[ch]: remove members fs.backing_store and
|
||||
fs.initial.
|
||||
|
||||
* app/core/gimplayer-floating-sel.[ch]: remove functions rigor(),
|
||||
relax(), store() and restore(), they are not needed any longer.
|
||||
Some minor cleanup, more to come.
|
||||
|
||||
* app/core/gimpprojection-construct.c: don't composite the
|
||||
floating selection before projecting because that happens on the
|
||||
fly now.
|
||||
|
||||
* app/core/core-enums.[ch]
|
||||
* app/core/gimpfloatingselundo.c
|
||||
* app/core/gimpimage-undo-push.[ch]: remove the rigor and relax
|
||||
undos.
|
||||
|
||||
* app/core/gimpdrawable.c
|
||||
* app/core/gimpimage-convert.c
|
||||
* app/core/gimpimage-duplicate.c
|
||||
* app/core/gimpimage.c
|
||||
* app/core/gimplayer.c
|
||||
* app/xcf/xcf-save.c: remove all calls to rigor and relax and all
|
||||
implementations of virtual functions that were just there to
|
||||
rigor/releax around chaining up.
|
||||
|
||||
* tools/pdbgen/pdb/floating_sel.pdb: remove all code from the
|
||||
rigor and relax wrappers and deprecate the API.
|
||||
|
||||
* app/pdb/floating-sel-cmds.c
|
||||
* libgimp/gimpfloatingsel_pdb.[ch]: regenerated.
|
||||
|
||||
* plug-ins/file-xjt/xjt.c: don't call rigor and relax.
|
||||
|
||||
2008-11-09 Martin Nordholts <martinn@svn.gnome.org>
|
||||
|
||||
* app/widgets/gimpcursorview.[ch]: Don't expose implementation
|
||||
|
|
|
@ -855,8 +855,6 @@ gimp_undo_type_get_type (void)
|
|||
{ GIMP_UNDO_VECTORS_MOD, "GIMP_UNDO_VECTORS_MOD", "vectors-mod" },
|
||||
{ GIMP_UNDO_VECTORS_REPOSITION, "GIMP_UNDO_VECTORS_REPOSITION", "vectors-reposition" },
|
||||
{ GIMP_UNDO_FS_TO_LAYER, "GIMP_UNDO_FS_TO_LAYER", "fs-to-layer" },
|
||||
{ GIMP_UNDO_FS_RIGOR, "GIMP_UNDO_FS_RIGOR", "fs-rigor" },
|
||||
{ GIMP_UNDO_FS_RELAX, "GIMP_UNDO_FS_RELAX", "fs-relax" },
|
||||
{ GIMP_UNDO_TRANSFORM, "GIMP_UNDO_TRANSFORM", "transform" },
|
||||
{ GIMP_UNDO_PAINT, "GIMP_UNDO_PAINT", "paint" },
|
||||
{ GIMP_UNDO_INK, "GIMP_UNDO_INK", "ink" },
|
||||
|
@ -943,8 +941,6 @@ gimp_undo_type_get_type (void)
|
|||
{ GIMP_UNDO_VECTORS_MOD, NC_("undo-type", "Path modification"), NULL },
|
||||
{ GIMP_UNDO_VECTORS_REPOSITION, NC_("undo-type", "Reposition path"), NULL },
|
||||
{ GIMP_UNDO_FS_TO_LAYER, NC_("undo-type", "Floating selection to layer"), NULL },
|
||||
{ GIMP_UNDO_FS_RIGOR, NC_("undo-type", "Rigor floating selection"), NULL },
|
||||
{ GIMP_UNDO_FS_RELAX, NC_("undo-type", "Relax floating selection"), NULL },
|
||||
{ GIMP_UNDO_TRANSFORM, NC_("undo-type", "Transform"), NULL },
|
||||
{ GIMP_UNDO_PAINT, NC_("undo-type", "Paint"), NULL },
|
||||
{ GIMP_UNDO_INK, NC_("undo-type", "Ink"), NULL },
|
||||
|
|
|
@ -437,8 +437,6 @@ typedef enum /*< pdb-skip >*/
|
|||
GIMP_UNDO_VECTORS_MOD, /*< desc="Path modification" >*/
|
||||
GIMP_UNDO_VECTORS_REPOSITION, /*< desc="Reposition path" >*/
|
||||
GIMP_UNDO_FS_TO_LAYER, /*< desc="Floating selection to layer" >*/
|
||||
GIMP_UNDO_FS_RIGOR, /*< desc="Rigor floating selection" >*/
|
||||
GIMP_UNDO_FS_RELAX, /*< desc="Relax floating selection" >*/
|
||||
GIMP_UNDO_TRANSFORM, /*< desc="Transform" >*/
|
||||
GIMP_UNDO_PAINT, /*< desc="Paint" >*/
|
||||
GIMP_UNDO_INK, /*< desc="Ink" >*/
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "core-types.h"
|
||||
|
||||
#include "base/pixel-region.h"
|
||||
#include "base/tile-manager.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
|
@ -45,6 +46,7 @@ gimp_channel_project_region (GimpDrawable *drawable,
|
|||
{
|
||||
GimpChannel *channel = GIMP_CHANNEL (drawable);
|
||||
PixelRegion srcPR;
|
||||
TileManager *temp_tiles;
|
||||
guchar col[3];
|
||||
guchar opacity;
|
||||
|
||||
|
@ -52,7 +54,8 @@ gimp_channel_project_region (GimpDrawable *drawable,
|
|||
&col[0], &col[1], &col[2], &opacity);
|
||||
|
||||
gimp_drawable_init_src_region (drawable, &srcPR,
|
||||
x, y, width, height);
|
||||
x, y, width, height,
|
||||
&temp_tiles);
|
||||
|
||||
if (combine)
|
||||
{
|
||||
|
@ -74,4 +77,7 @@ gimp_channel_project_region (GimpDrawable *drawable,
|
|||
INITIAL_CHANNEL_MASK :
|
||||
INITIAL_CHANNEL_SELECTION));
|
||||
}
|
||||
|
||||
if (temp_tiles)
|
||||
tile_manager_unref (temp_tiles);
|
||||
}
|
||||
|
|
|
@ -79,10 +79,6 @@ static void gimp_drawable_removed (GimpItem *item);
|
|||
static void gimp_drawable_visibility_changed (GimpItem *item);
|
||||
static GimpItem * gimp_drawable_duplicate (GimpItem *item,
|
||||
GType new_type);
|
||||
static void gimp_drawable_translate (GimpItem *item,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gboolean push_undo);
|
||||
static void gimp_drawable_scale (GimpItem *item,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
|
@ -207,7 +203,6 @@ gimp_drawable_class_init (GimpDrawableClass *klass)
|
|||
item_class->removed = gimp_drawable_removed;
|
||||
item_class->visibility_changed = gimp_drawable_visibility_changed;
|
||||
item_class->duplicate = gimp_drawable_duplicate;
|
||||
item_class->translate = gimp_drawable_translate;
|
||||
item_class->scale = gimp_drawable_scale;
|
||||
item_class->resize = gimp_drawable_resize;
|
||||
item_class->flip = gimp_drawable_flip;
|
||||
|
@ -410,25 +405,6 @@ gimp_drawable_duplicate (GimpItem *item,
|
|||
return new_item;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_translate (GimpItem *item,
|
||||
gint offset_x,
|
||||
gint offset_y,
|
||||
gboolean push_undo)
|
||||
{
|
||||
GimpDrawable *drawable = GIMP_DRAWABLE (item);
|
||||
GimpImage *image = gimp_item_get_image (item);
|
||||
|
||||
if (gimp_drawable_has_floating_sel (drawable))
|
||||
floating_sel_relax (gimp_image_floating_sel (image), FALSE);
|
||||
|
||||
GIMP_ITEM_CLASS (parent_class)->translate (item, offset_x, offset_y,
|
||||
push_undo);
|
||||
|
||||
if (gimp_drawable_has_floating_sel (drawable))
|
||||
floating_sel_rigor (gimp_image_floating_sel (image), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_drawable_scale (GimpItem *item,
|
||||
gint new_width,
|
||||
|
@ -1059,32 +1035,111 @@ gimp_drawable_project_region (GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_drawable_init_src_region (GimpDrawable *drawable,
|
||||
PixelRegion *srcPR,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
gimp_drawable_init_src_region (GimpDrawable *drawable,
|
||||
PixelRegion *srcPR,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
TileManager **temp_tiles)
|
||||
{
|
||||
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);
|
||||
g_return_if_fail (temp_tiles != 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);
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
GimpLayer *fs = gimp_image_floating_sel (image);
|
||||
gint off_x, off_y;
|
||||
gint fs_off_x, fs_off_y;
|
||||
gint combine_x, combine_y;
|
||||
gint combine_width, combine_height;
|
||||
|
||||
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
||||
gimp_item_get_offset (GIMP_ITEM (fs), &fs_off_x, &fs_off_y);
|
||||
|
||||
if (gimp_item_get_visible (GIMP_ITEM (fs)) &&
|
||||
gimp_rectangle_intersect (x + off_x, y + off_y,
|
||||
width, height,
|
||||
fs_off_x, fs_off_y,
|
||||
gimp_item_get_width (GIMP_ITEM (fs)),
|
||||
gimp_item_get_height (GIMP_ITEM (fs)),
|
||||
&combine_x, &combine_y,
|
||||
&combine_width, &combine_height))
|
||||
{
|
||||
PixelRegion tempPR;
|
||||
PixelRegion destPR;
|
||||
PixelRegion fsPR;
|
||||
gboolean lock_alpha = FALSE;
|
||||
|
||||
/* a temporary buffer for the compisition of the drawable and
|
||||
* its floating selection
|
||||
*/
|
||||
*temp_tiles = tile_manager_new (width, height,
|
||||
gimp_drawable_bytes (drawable));
|
||||
|
||||
/* first, initialize the entire buffer with the drawable's
|
||||
* contents
|
||||
*/
|
||||
pixel_region_init (&tempPR, gimp_drawable_get_tiles (drawable),
|
||||
x, y, width, height,
|
||||
FALSE);
|
||||
pixel_region_init (&destPR, *temp_tiles,
|
||||
0, 0, width, height,
|
||||
TRUE);
|
||||
copy_region (&tempPR, &destPR);
|
||||
|
||||
/* then, apply the floating selection onto the buffer just as
|
||||
* we apply it onto the drawable when anchoring the floating
|
||||
* selection
|
||||
*/
|
||||
pixel_region_init (&fsPR,
|
||||
gimp_drawable_get_tiles (GIMP_DRAWABLE (fs)),
|
||||
combine_x - fs_off_x,
|
||||
combine_y - fs_off_y,
|
||||
combine_width, combine_height,
|
||||
FALSE);
|
||||
pixel_region_init (&destPR, *temp_tiles,
|
||||
combine_x - x - off_x, combine_y - y - off_y,
|
||||
combine_width, combine_height,
|
||||
TRUE);
|
||||
|
||||
if (GIMP_IS_LAYER (drawable))
|
||||
{
|
||||
lock_alpha = gimp_layer_get_lock_alpha (GIMP_LAYER (drawable));
|
||||
|
||||
if (lock_alpha)
|
||||
gimp_layer_set_lock_alpha (GIMP_LAYER (drawable), FALSE, FALSE);
|
||||
}
|
||||
|
||||
gimp_drawable_apply_region (drawable, &fsPR,
|
||||
FALSE, NULL,
|
||||
gimp_layer_get_opacity (fs),
|
||||
gimp_layer_get_mode (fs),
|
||||
NULL, &destPR,
|
||||
combine_x - off_y,
|
||||
combine_y - off_y);
|
||||
|
||||
if (lock_alpha)
|
||||
gimp_layer_set_lock_alpha (GIMP_LAYER (drawable), TRUE, FALSE);
|
||||
|
||||
/* finally, return a PixelRegion on the composited buffer instead
|
||||
* of the drawable's tiles
|
||||
*/
|
||||
pixel_region_init (srcPR, *temp_tiles,
|
||||
0, 0, width, height,
|
||||
FALSE);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pixel_region_init (srcPR, gimp_drawable_get_tiles (drawable),
|
||||
x, y, width, height,
|
||||
FALSE);
|
||||
*temp_tiles = NULL;
|
||||
}
|
||||
|
||||
TileManager *
|
||||
|
@ -1149,17 +1204,11 @@ gimp_drawable_set_tiles_full (GimpDrawable *drawable,
|
|||
gimp_item_get_height (item));
|
||||
}
|
||||
|
||||
if (gimp_drawable_has_floating_sel (drawable))
|
||||
floating_sel_relax (gimp_image_floating_sel (image), FALSE);
|
||||
|
||||
GIMP_DRAWABLE_GET_CLASS (drawable)->set_tiles (drawable,
|
||||
push_undo, undo_desc,
|
||||
tiles, type,
|
||||
offset_x, offset_y);
|
||||
|
||||
if (gimp_drawable_has_floating_sel (drawable))
|
||||
floating_sel_rigor (gimp_image_floating_sel (image), FALSE);
|
||||
|
||||
gimp_drawable_update (drawable,
|
||||
0, 0,
|
||||
gimp_item_get_width (item),
|
||||
|
|
|
@ -179,7 +179,8 @@ void gimp_drawable_init_src_region (GimpDrawable *drawable,
|
|||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
gint height,
|
||||
TileManager **temp_tiles);
|
||||
|
||||
TileManager * gimp_drawable_get_tiles (GimpDrawable *drawable);
|
||||
void gimp_drawable_set_tiles (GimpDrawable *drawable,
|
||||
|
|
|
@ -37,8 +37,6 @@ static GObject * gimp_floating_sel_undo_constructor (GType type
|
|||
static void gimp_floating_sel_undo_pop (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode,
|
||||
GimpUndoAccumulator *accum);
|
||||
static void gimp_floating_sel_undo_free (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpFloatingSelUndo, gimp_floating_sel_undo, GIMP_TYPE_ITEM_UNDO)
|
||||
|
@ -55,7 +53,6 @@ gimp_floating_sel_undo_class_init (GimpFloatingSelUndoClass *klass)
|
|||
object_class->constructor = gimp_floating_sel_undo_constructor;
|
||||
|
||||
undo_class->pop = gimp_floating_sel_undo_pop;
|
||||
undo_class->free = gimp_floating_sel_undo_free;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -82,10 +79,6 @@ gimp_floating_sel_undo_constructor (GType type,
|
|||
|
||||
switch (GIMP_UNDO (object)->undo_type)
|
||||
{
|
||||
case GIMP_UNDO_FS_RIGOR:
|
||||
case GIMP_UNDO_FS_RELAX:
|
||||
break;
|
||||
|
||||
case GIMP_UNDO_FS_TO_LAYER:
|
||||
floating_sel_undo->drawable = layer->fs.drawable;
|
||||
break;
|
||||
|
@ -109,24 +102,6 @@ gimp_floating_sel_undo_pop (GimpUndo *undo,
|
|||
|
||||
switch (undo->undo_type)
|
||||
{
|
||||
case GIMP_UNDO_FS_RIGOR:
|
||||
case GIMP_UNDO_FS_RELAX:
|
||||
if (! gimp_layer_is_floating_sel (floating_layer))
|
||||
return;
|
||||
|
||||
if ((undo_mode == GIMP_UNDO_MODE_UNDO &&
|
||||
undo->undo_type == GIMP_UNDO_FS_RIGOR) ||
|
||||
(undo_mode == GIMP_UNDO_MODE_REDO &&
|
||||
undo->undo_type == GIMP_UNDO_FS_RELAX))
|
||||
{
|
||||
floating_sel_relax (floating_layer, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
floating_sel_rigor (floating_layer, FALSE);
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_UNDO_FS_TO_LAYER:
|
||||
if (undo_mode == GIMP_UNDO_MODE_UNDO)
|
||||
{
|
||||
|
@ -137,26 +112,11 @@ gimp_floating_sel_undo_pop (GimpUndo *undo,
|
|||
gimp_image_set_active_layer (undo->image, floating_layer);
|
||||
undo->image->floating_sel = floating_layer;
|
||||
|
||||
/* store the contents of the drawable */
|
||||
floating_sel_store (floating_layer,
|
||||
GIMP_ITEM (floating_layer)->offset_x,
|
||||
GIMP_ITEM (floating_layer)->offset_y,
|
||||
gimp_item_get_width (GIMP_ITEM (floating_layer)),
|
||||
gimp_item_get_height (GIMP_ITEM (floating_layer)));
|
||||
floating_layer->fs.initial = TRUE;
|
||||
|
||||
/* clear the selection */
|
||||
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (floating_layer));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* restore the contents of the drawable */
|
||||
floating_sel_restore (floating_layer,
|
||||
GIMP_ITEM (floating_layer)->offset_x,
|
||||
GIMP_ITEM (floating_layer)->offset_y,
|
||||
gimp_item_get_width (GIMP_ITEM (floating_layer)),
|
||||
gimp_item_get_height (GIMP_ITEM (floating_layer)));
|
||||
|
||||
/* Update the preview for the underlying drawable */
|
||||
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (floating_layer));
|
||||
|
||||
|
@ -182,19 +142,3 @@ gimp_floating_sel_undo_pop (GimpUndo *undo,
|
|||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_floating_sel_undo_free (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode)
|
||||
{
|
||||
GimpLayer *floating_layer = GIMP_LAYER (GIMP_ITEM_UNDO (undo)->item);
|
||||
|
||||
if (undo->undo_type == GIMP_UNDO_FS_TO_LAYER &&
|
||||
undo_mode == GIMP_UNDO_MODE_UNDO)
|
||||
{
|
||||
tile_manager_unref (floating_layer->fs.backing_store);
|
||||
floating_layer->fs.backing_store = NULL;
|
||||
}
|
||||
|
||||
GIMP_UNDO_CLASS (parent_class)->free (undo, undo_mode);
|
||||
}
|
||||
|
|
|
@ -820,9 +820,6 @@ gimp_image_convert (GimpImage *image,
|
|||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_CONVERT,
|
||||
undo_desc);
|
||||
|
||||
if (gimp_image_floating_sel (image))
|
||||
floating_sel_relax (gimp_image_floating_sel (image), TRUE);
|
||||
|
||||
/* Push the image type to the stack */
|
||||
gimp_image_undo_push_image_type (image, NULL);
|
||||
|
||||
|
@ -1070,9 +1067,6 @@ gimp_image_convert (GimpImage *image,
|
|||
if (quantobj)
|
||||
quantobj->delete_func (quantobj);
|
||||
|
||||
if (gimp_image_floating_sel (image))
|
||||
floating_sel_rigor (gimp_image_floating_sel (image), TRUE);
|
||||
|
||||
gimp_image_undo_group_end (image);
|
||||
|
||||
gimp_image_mode_changed (image);
|
||||
|
|
|
@ -97,8 +97,6 @@ gimp_image_duplicate (GimpImage *image)
|
|||
floating_layer = gimp_image_floating_sel (image);
|
||||
if (floating_layer)
|
||||
{
|
||||
floating_sel_relax (floating_layer, FALSE);
|
||||
|
||||
floating_sel_drawable = floating_layer->fs.drawable;
|
||||
floating_layer = NULL;
|
||||
}
|
||||
|
|
|
@ -807,45 +807,9 @@ gimp_image_undo_push_fs_to_layer (GimpImage *image,
|
|||
"item", floating_layer,
|
||||
NULL);
|
||||
|
||||
if (! undo)
|
||||
{
|
||||
tile_manager_unref (floating_layer->fs.backing_store);
|
||||
floating_layer->fs.backing_store = NULL;
|
||||
}
|
||||
|
||||
return undo;
|
||||
}
|
||||
|
||||
GimpUndo *
|
||||
gimp_image_undo_push_fs_rigor (GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpLayer *floating_layer)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_LAYER (floating_layer), NULL);
|
||||
|
||||
return gimp_image_undo_push (image, GIMP_TYPE_FLOATING_SEL_UNDO,
|
||||
GIMP_UNDO_FS_RIGOR, undo_desc,
|
||||
GIMP_DIRTY_NONE,
|
||||
"item", floating_layer,
|
||||
NULL);
|
||||
}
|
||||
|
||||
GimpUndo *
|
||||
gimp_image_undo_push_fs_relax (GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpLayer *floating_layer)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_LAYER (floating_layer), NULL);
|
||||
|
||||
return gimp_image_undo_push (image, GIMP_TYPE_FLOATING_SEL_UNDO,
|
||||
GIMP_UNDO_FS_RELAX, undo_desc,
|
||||
GIMP_DIRTY_NONE,
|
||||
"item", floating_layer,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* Something for which programmer is too lazy to write an undo function for */
|
||||
|
|
|
@ -200,12 +200,6 @@ GimpUndo * gimp_image_undo_push_vectors_reposition (GimpImage *image,
|
|||
GimpUndo * gimp_image_undo_push_fs_to_layer (GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpLayer *floating_layer);
|
||||
GimpUndo * gimp_image_undo_push_fs_rigor (GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpLayer *floating_layer);
|
||||
GimpUndo * gimp_image_undo_push_fs_relax (GimpImage *image,
|
||||
const gchar *undo_desc,
|
||||
GimpLayer *floating_layer);
|
||||
|
||||
|
||||
/* EEK undo */
|
||||
|
|
|
@ -1665,19 +1665,13 @@ gimp_image_set_component_active (GimpImage *image,
|
|||
{
|
||||
GimpLayer *floating_sel = gimp_image_floating_sel (image);
|
||||
|
||||
if (floating_sel)
|
||||
floating_sel_relax (floating_sel, FALSE);
|
||||
|
||||
image->active[index] = active ? TRUE : FALSE;
|
||||
|
||||
if (floating_sel)
|
||||
{
|
||||
floating_sel_rigor (floating_sel, FALSE);
|
||||
gimp_drawable_update (GIMP_DRAWABLE (floating_sel),
|
||||
0, 0,
|
||||
gimp_item_get_width (GIMP_ITEM (floating_sel)),
|
||||
gimp_item_get_height (GIMP_ITEM (floating_sel)));
|
||||
}
|
||||
gimp_drawable_update (GIMP_DRAWABLE (floating_sel),
|
||||
0, 0,
|
||||
gimp_item_get_width (GIMP_ITEM (floating_sel)),
|
||||
gimp_item_get_height (GIMP_ITEM (floating_sel)));
|
||||
|
||||
/* If there is an active channel and we mess with the components,
|
||||
* the active channel gets unset...
|
||||
|
|
|
@ -73,16 +73,10 @@ floating_sel_attach (GimpLayer *layer,
|
|||
|
||||
/* set the drawable and allocate a backing store */
|
||||
gimp_layer_set_lock_alpha (layer, TRUE, FALSE);
|
||||
layer->fs.drawable = drawable;
|
||||
layer->fs.backing_store = tile_manager_new (gimp_item_get_width (GIMP_ITEM (layer)),
|
||||
gimp_item_get_height (GIMP_ITEM (layer)),
|
||||
gimp_drawable_bytes (drawable));
|
||||
layer->fs.drawable = drawable;
|
||||
|
||||
/* add the layer to the image */
|
||||
gimp_image_add_layer (image, layer, 0, TRUE);
|
||||
|
||||
/* store the affected area from the drawable in the backing store */
|
||||
floating_sel_rigor (layer, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -98,9 +92,6 @@ floating_sel_remove (GimpLayer *layer)
|
|||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_FS_REMOVE,
|
||||
_("Remove Floating Selection"));
|
||||
|
||||
/* restore the affected area in the drawable from the backing store */
|
||||
floating_sel_relax (layer, TRUE);
|
||||
|
||||
/* Invalidate the preview of the obscured drawable. We do this here
|
||||
* because it will not be done until the floating selection is removed,
|
||||
* at which point the obscured drawable's preview will not be declared
|
||||
|
@ -134,9 +125,6 @@ floating_sel_anchor (GimpLayer *layer)
|
|||
*/
|
||||
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (layer->fs.drawable));
|
||||
|
||||
/* Relax the floating selection */
|
||||
floating_sel_relax (layer, TRUE);
|
||||
|
||||
/* Composite the floating selection contents */
|
||||
floating_sel_composite (layer,
|
||||
GIMP_ITEM (layer)->offset_x,
|
||||
|
@ -211,20 +199,13 @@ floating_sel_to_layer (GimpLayer *layer,
|
|||
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_FS_TO_LAYER,
|
||||
_("Floating Selection to Layer"));
|
||||
|
||||
/* restore the contents of the drawable */
|
||||
floating_sel_restore (layer,
|
||||
item->offset_x,
|
||||
item->offset_y,
|
||||
gimp_item_get_width (item),
|
||||
gimp_item_get_height (item));
|
||||
|
||||
gimp_image_undo_push_fs_to_layer (image, NULL, layer);
|
||||
|
||||
/* clear the selection */
|
||||
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (layer));
|
||||
|
||||
/* Set pointers */
|
||||
layer->fs.drawable = NULL;
|
||||
layer->fs.drawable = NULL;
|
||||
image->floating_sel = NULL;
|
||||
|
||||
gimp_item_set_visible (item, TRUE, TRUE);
|
||||
|
@ -244,162 +225,6 @@ floating_sel_to_layer (GimpLayer *layer,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
floating_sel_store (GimpLayer *layer,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
gint offx, offy;
|
||||
gint x1, y1, x2, y2;
|
||||
|
||||
g_return_if_fail (GIMP_IS_LAYER (layer));
|
||||
g_return_if_fail (gimp_layer_is_floating_sel (layer));
|
||||
|
||||
/* Check the backing store & make sure it has the correct dimensions */
|
||||
if ((tile_manager_width (layer->fs.backing_store) !=
|
||||
gimp_item_get_width (GIMP_ITEM(layer))) ||
|
||||
(tile_manager_height (layer->fs.backing_store) !=
|
||||
gimp_item_get_height (GIMP_ITEM(layer))) ||
|
||||
(tile_manager_bpp (layer->fs.backing_store) !=
|
||||
gimp_drawable_bytes (layer->fs.drawable)))
|
||||
{
|
||||
/* free the backing store and allocate anew */
|
||||
tile_manager_unref (layer->fs.backing_store);
|
||||
|
||||
layer->fs.backing_store =
|
||||
tile_manager_new (gimp_item_get_width (GIMP_ITEM (layer)),
|
||||
gimp_item_get_height (GIMP_ITEM (layer)),
|
||||
gimp_drawable_bytes (layer->fs.drawable));
|
||||
}
|
||||
|
||||
/* What this function does is save the specified area of the
|
||||
* drawable that this floating selection obscures. We do this so
|
||||
* that it will be possible to subsequently restore the drawable's area
|
||||
*/
|
||||
gimp_item_get_offset (GIMP_ITEM (layer->fs.drawable), &offx, &offy);
|
||||
|
||||
/* Find the minimum area we need to uncover -- in image space */
|
||||
x1 = MAX (GIMP_ITEM (layer)->offset_x, offx);
|
||||
y1 = MAX (GIMP_ITEM (layer)->offset_y, offy);
|
||||
x2 = MIN (GIMP_ITEM (layer)->offset_x + gimp_item_get_width (GIMP_ITEM (layer)),
|
||||
offx + gimp_item_get_width (GIMP_ITEM (layer->fs.drawable)));
|
||||
y2 = MIN (GIMP_ITEM (layer)->offset_y + gimp_item_get_height (GIMP_ITEM (layer)),
|
||||
offy + gimp_item_get_height (GIMP_ITEM (layer->fs.drawable)));
|
||||
|
||||
x1 = CLAMP (x, x1, x2);
|
||||
y1 = CLAMP (y, y1, y2);
|
||||
x2 = CLAMP (x + w, x1, x2);
|
||||
y2 = CLAMP (y + h, y1, y2);
|
||||
|
||||
if ((x2 - x1) > 0 && (y2 - y1) > 0)
|
||||
{
|
||||
/* Copy the area from the drawable to the backing store */
|
||||
pixel_region_init (&srcPR, gimp_drawable_get_tiles (layer->fs.drawable),
|
||||
(x1 - offx), (y1 - offy), (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, layer->fs.backing_store,
|
||||
(x1 - GIMP_ITEM (layer)->offset_x),
|
||||
(y1 - GIMP_ITEM (layer)->offset_y),
|
||||
(x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
floating_sel_restore (GimpLayer *layer,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
PixelRegion srcPR, destPR;
|
||||
gint offx, offy;
|
||||
gint x1, y1, x2, y2;
|
||||
|
||||
g_return_if_fail (GIMP_IS_LAYER (layer));
|
||||
g_return_if_fail (gimp_layer_is_floating_sel (layer));
|
||||
|
||||
/* What this function does is "uncover" the specified area in the
|
||||
* drawable that this floating selection obscures. We do this so
|
||||
* that either the floating selection can be removed or it can be
|
||||
* translated
|
||||
*/
|
||||
|
||||
/* Find the minimum area we need to uncover -- in image space */
|
||||
gimp_item_get_offset (GIMP_ITEM (layer->fs.drawable), &offx, &offy);
|
||||
|
||||
x1 = MAX (GIMP_ITEM (layer)->offset_x, offx);
|
||||
y1 = MAX (GIMP_ITEM (layer)->offset_y, offy);
|
||||
x2 = MIN (GIMP_ITEM (layer)->offset_x + gimp_item_get_width (GIMP_ITEM (layer)),
|
||||
offx + gimp_item_get_width (GIMP_ITEM (layer->fs.drawable)));
|
||||
y2 = MIN (GIMP_ITEM (layer)->offset_y + gimp_item_get_height (GIMP_ITEM (layer)),
|
||||
offy + gimp_item_get_height (GIMP_ITEM (layer->fs.drawable)));
|
||||
|
||||
x1 = CLAMP (x, x1, x2);
|
||||
y1 = CLAMP (y, y1, y2);
|
||||
x2 = CLAMP (x + w, x1, x2);
|
||||
y2 = CLAMP (y + h, y1, y2);
|
||||
|
||||
if ((x2 - x1) > 0 && (y2 - y1) > 0)
|
||||
{
|
||||
/* Copy the area from the backing store to the drawable */
|
||||
pixel_region_init (&srcPR, layer->fs.backing_store,
|
||||
(x1 - GIMP_ITEM (layer)->offset_x),
|
||||
(y1 - GIMP_ITEM (layer)->offset_y),
|
||||
(x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, gimp_drawable_get_tiles (layer->fs.drawable),
|
||||
(x1 - offx), (y1 - offy), (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
copy_region (&srcPR, &destPR);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
floating_sel_rigor (GimpLayer *layer,
|
||||
gboolean push_undo)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_LAYER (layer));
|
||||
g_return_if_fail (gimp_layer_is_floating_sel (layer));
|
||||
|
||||
/* store the affected area from the drawable in the backing store */
|
||||
floating_sel_store (layer,
|
||||
GIMP_ITEM (layer)->offset_x,
|
||||
GIMP_ITEM (layer)->offset_y,
|
||||
gimp_item_get_width (GIMP_ITEM (layer)),
|
||||
gimp_item_get_height (GIMP_ITEM (layer)));
|
||||
layer->fs.initial = TRUE;
|
||||
|
||||
if (push_undo)
|
||||
gimp_image_undo_push_fs_rigor (gimp_item_get_image (GIMP_ITEM (layer)),
|
||||
NULL,
|
||||
layer);
|
||||
}
|
||||
|
||||
void
|
||||
floating_sel_relax (GimpLayer *layer,
|
||||
gboolean push_undo)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_LAYER (layer));
|
||||
g_return_if_fail (gimp_layer_is_floating_sel (layer));
|
||||
|
||||
/* restore the contents of drawable the floating layer is attached to */
|
||||
if (layer->fs.initial == FALSE)
|
||||
floating_sel_restore (layer,
|
||||
GIMP_ITEM (layer)->offset_x,
|
||||
GIMP_ITEM (layer)->offset_y,
|
||||
gimp_item_get_width (GIMP_ITEM (layer)),
|
||||
gimp_item_get_height (GIMP_ITEM (layer)));
|
||||
layer->fs.initial = TRUE;
|
||||
|
||||
if (push_undo)
|
||||
gimp_image_undo_push_fs_relax (gimp_item_get_image (GIMP_ITEM (layer)),
|
||||
NULL,
|
||||
layer);
|
||||
}
|
||||
|
||||
void
|
||||
floating_sel_composite (GimpLayer *layer,
|
||||
gint x,
|
||||
|
@ -421,14 +246,6 @@ floating_sel_composite (GimpLayer *layer,
|
|||
* is constructed, before any other composition takes place.
|
||||
*/
|
||||
|
||||
/* If this isn't the first composite,
|
||||
* restore the image underneath
|
||||
*/
|
||||
if (! layer->fs.initial)
|
||||
floating_sel_restore (layer, x, y, w, h);
|
||||
else if (gimp_item_get_visible (GIMP_ITEM (layer)))
|
||||
layer->fs.initial = FALSE;
|
||||
|
||||
/* First restore what's behind the image if necessary,
|
||||
* then check for visibility
|
||||
*/
|
||||
|
@ -457,8 +274,8 @@ floating_sel_composite (GimpLayer *layer,
|
|||
if ((x2 - x1) > 0 && (y2 - y1) > 0)
|
||||
{
|
||||
PixelRegion fsPR;
|
||||
GimpLayer *d_layer = NULL;
|
||||
gboolean lock_alpha;
|
||||
GimpLayer *d_layer = NULL;
|
||||
gboolean lock_alpha = FALSE;
|
||||
|
||||
/* composite the area from the layer to the drawable */
|
||||
pixel_region_init (&fsPR,
|
||||
|
@ -474,11 +291,12 @@ floating_sel_composite (GimpLayer *layer,
|
|||
if (GIMP_IS_LAYER (layer->fs.drawable))
|
||||
{
|
||||
d_layer = GIMP_LAYER (layer->fs.drawable);
|
||||
if ((lock_alpha = gimp_layer_get_lock_alpha (d_layer)))
|
||||
|
||||
lock_alpha = gimp_layer_get_lock_alpha (d_layer);
|
||||
|
||||
if (lock_alpha)
|
||||
gimp_layer_set_lock_alpha (d_layer, FALSE, FALSE);
|
||||
}
|
||||
else
|
||||
lock_alpha = FALSE;
|
||||
|
||||
/* apply the fs with the undo specified by the value
|
||||
* passed to this function
|
||||
|
@ -488,7 +306,7 @@ floating_sel_composite (GimpLayer *layer,
|
|||
gimp_layer_get_opacity (layer),
|
||||
gimp_layer_get_mode (layer),
|
||||
NULL, NULL,
|
||||
(x1 - offx), (y1 - offy));
|
||||
x1 - offx, y1 - offy);
|
||||
|
||||
/* restore lock alpha */
|
||||
if (lock_alpha)
|
||||
|
|
|
@ -27,20 +27,6 @@ void floating_sel_anchor (GimpLayer *layer);
|
|||
void floating_sel_activate_drawable (GimpLayer *layer);
|
||||
gboolean floating_sel_to_layer (GimpLayer *layer,
|
||||
GError **error);
|
||||
void floating_sel_store (GimpLayer *layer,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
void floating_sel_restore (GimpLayer *layer,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
void floating_sel_rigor (GimpLayer *layer,
|
||||
gboolean push_undo);
|
||||
void floating_sel_relax (GimpLayer *layer,
|
||||
gboolean push_undo);
|
||||
void floating_sel_composite (GimpLayer *layer,
|
||||
gint x,
|
||||
gint y,
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "core-types.h"
|
||||
|
||||
#include "base/pixel-region.h"
|
||||
#include "base/tile-manager.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
|
@ -51,32 +52,41 @@ gimp_layer_project_region (GimpDrawable *drawable,
|
|||
{
|
||||
/* If we're showing the layer mask instead of the layer... */
|
||||
|
||||
PixelRegion srcPR;
|
||||
PixelRegion srcPR;
|
||||
TileManager *temp_tiles;
|
||||
|
||||
gimp_drawable_init_src_region (GIMP_DRAWABLE (mask), &srcPR,
|
||||
x, y, width, height);
|
||||
x, y, width, height,
|
||||
&temp_tiles);
|
||||
|
||||
copy_gray_to_region (&srcPR, projPR);
|
||||
|
||||
if (temp_tiles)
|
||||
tile_manager_unref (temp_tiles);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise, normal */
|
||||
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
|
||||
PixelRegion srcPR;
|
||||
PixelRegion maskPR;
|
||||
PixelRegion *mask_pr = NULL;
|
||||
const guchar *colormap = NULL;
|
||||
PixelRegion *mask_pr = NULL;
|
||||
const guchar *colormap = NULL;
|
||||
TileManager *temp_mask_tiles = NULL;
|
||||
TileManager *temp_layer_tiles = NULL;
|
||||
InitialMode initial_mode;
|
||||
CombinationMode combination_mode;
|
||||
|
||||
gimp_drawable_init_src_region (drawable, &srcPR,
|
||||
x, y, width, height);
|
||||
x, y, width, height,
|
||||
&temp_layer_tiles);
|
||||
|
||||
if (mask && gimp_layer_mask_get_apply (mask))
|
||||
{
|
||||
gimp_drawable_init_src_region (GIMP_DRAWABLE (mask), &maskPR,
|
||||
x, y, width, height);
|
||||
x, y, width, height,
|
||||
&temp_mask_tiles);
|
||||
mask_pr = &maskPR;
|
||||
}
|
||||
|
||||
|
@ -132,5 +142,11 @@ gimp_layer_project_region (GimpDrawable *drawable,
|
|||
image->visible,
|
||||
initial_mode);
|
||||
}
|
||||
|
||||
if (temp_layer_tiles)
|
||||
tile_manager_unref (temp_layer_tiles);
|
||||
|
||||
if (temp_mask_tiles)
|
||||
tile_manager_unref (temp_mask_tiles);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,13 +159,6 @@ static gint64 gimp_layer_estimate_memsize (const GimpDrawable *drawable,
|
|||
static void gimp_layer_invalidate_boundary (GimpDrawable *drawable);
|
||||
static void gimp_layer_get_active_components (const GimpDrawable *drawable,
|
||||
gboolean *active);
|
||||
static void gimp_layer_set_tiles (GimpDrawable *drawable,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
TileManager *tiles,
|
||||
GimpImageType type,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
static GeglNode * gimp_layer_get_node (GimpItem *item);
|
||||
|
||||
static gint gimp_layer_get_opacity_at (GimpPickable *pickable,
|
||||
|
@ -277,7 +270,6 @@ gimp_layer_class_init (GimpLayerClass *klass)
|
|||
drawable_class->invalidate_boundary = gimp_layer_invalidate_boundary;
|
||||
drawable_class->get_active_components = gimp_layer_get_active_components;
|
||||
drawable_class->project_region = gimp_layer_project_region;
|
||||
drawable_class->set_tiles = gimp_layer_set_tiles;
|
||||
|
||||
klass->opacity_changed = NULL;
|
||||
klass->mode_changed = NULL;
|
||||
|
@ -314,9 +306,7 @@ gimp_layer_init (GimpLayer *layer)
|
|||
layer->mask = NULL;
|
||||
|
||||
/* floating selection */
|
||||
layer->fs.backing_store = NULL;
|
||||
layer->fs.drawable = NULL;
|
||||
layer->fs.initial = TRUE;
|
||||
layer->fs.boundary_known = FALSE;
|
||||
layer->fs.segs = NULL;
|
||||
layer->fs.num_segs = 0;
|
||||
|
@ -396,12 +386,6 @@ gimp_layer_finalize (GObject *object)
|
|||
layer->mask = NULL;
|
||||
}
|
||||
|
||||
if (layer->fs.backing_store)
|
||||
{
|
||||
tile_manager_unref (layer->fs.backing_store);
|
||||
layer->fs.backing_store = NULL;
|
||||
}
|
||||
|
||||
if (layer->fs.segs)
|
||||
{
|
||||
g_free (layer->fs.segs);
|
||||
|
@ -438,7 +422,6 @@ gimp_layer_get_memsize (GimpObject *object,
|
|||
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (layer->mask), gui_size);
|
||||
|
||||
*gui_size += tile_manager_get_memsize (layer->fs.backing_store, FALSE);
|
||||
*gui_size += layer->fs.num_segs * sizeof (BoundSeg);
|
||||
|
||||
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
|
||||
|
@ -487,29 +470,6 @@ gimp_layer_get_active_components (const GimpDrawable *drawable,
|
|||
active[gimp_drawable_bytes (drawable) - 1] = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_layer_set_tiles (GimpDrawable *drawable,
|
||||
gboolean push_undo,
|
||||
const gchar *undo_desc,
|
||||
TileManager *tiles,
|
||||
GimpImageType type,
|
||||
gint offset_x,
|
||||
gint offset_y)
|
||||
{
|
||||
GimpLayer *layer = GIMP_LAYER (drawable);
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
floating_sel_relax (layer, FALSE);
|
||||
|
||||
GIMP_DRAWABLE_CLASS (parent_class)->set_tiles (drawable,
|
||||
push_undo, undo_desc,
|
||||
tiles, type,
|
||||
offset_x, offset_y);
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
floating_sel_rigor (layer, FALSE);
|
||||
}
|
||||
|
||||
static GeglNode *
|
||||
gimp_layer_get_node (GimpItem *item)
|
||||
{
|
||||
|
@ -752,15 +712,9 @@ gimp_layer_translate (GimpItem *item,
|
|||
/* invalidate the selection boundary because of a layer modification */
|
||||
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (layer));
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
floating_sel_relax (layer, FALSE);
|
||||
|
||||
GIMP_ITEM_CLASS (parent_class)->translate (item, offset_x, offset_y,
|
||||
push_undo);
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
floating_sel_rigor (layer, FALSE);
|
||||
|
||||
/* update the new region */
|
||||
gimp_drawable_update (GIMP_DRAWABLE (layer),
|
||||
0, 0,
|
||||
|
|
|
@ -48,10 +48,7 @@ struct _GimpLayer
|
|||
/* Floating selections */
|
||||
struct
|
||||
{
|
||||
TileManager *backing_store; /* for obscured regions */
|
||||
GimpDrawable *drawable; /* floating sel is attached to */
|
||||
gboolean initial; /* is fs composited yet? */
|
||||
|
||||
gboolean boundary_known; /* is the current boundary valid */
|
||||
BoundSeg *segs; /* boundary of floating sel */
|
||||
gint num_segs; /* number of segs in boundary */
|
||||
|
|
|
@ -191,13 +191,8 @@ gimp_projection_construct_legacy (GimpProjection *proj,
|
|||
{
|
||||
GimpLayer *layer = list->data;
|
||||
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
{
|
||||
/* composite the floating selection if it exists
|
||||
*/
|
||||
floating_sel_composite (layer, x, y, w, h, FALSE);
|
||||
}
|
||||
else if (gimp_item_get_visible (GIMP_ITEM (layer)))
|
||||
if (! gimp_layer_is_floating_sel (layer) &&
|
||||
gimp_item_get_visible (GIMP_ITEM (layer)))
|
||||
{
|
||||
/* only add layers that are visible and not floating selections
|
||||
* to the list
|
||||
|
|
|
@ -178,17 +178,6 @@ floating_sel_rigor_invoker (GimpProcedure *procedure,
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp_layer_is_floating_sel (floating_sel))
|
||||
{
|
||||
floating_sel_rigor (floating_sel, undo);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
|
||||
_("Cannot rigor this layer because "
|
||||
"it is not a floating selection."));
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success,
|
||||
|
@ -212,17 +201,6 @@ floating_sel_relax_invoker (GimpProcedure *procedure,
|
|||
|
||||
if (success)
|
||||
{
|
||||
if (gimp_layer_is_floating_sel (floating_sel))
|
||||
{
|
||||
floating_sel_relax (floating_sel, undo);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
|
||||
_("Cannot relax this layer because "
|
||||
"it is not a floating selection."));
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return gimp_procedure_get_return_values (procedure, success,
|
||||
|
@ -340,12 +318,12 @@ register_floating_sel_procs (GimpPDB *pdb)
|
|||
"gimp-floating-sel-rigor");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-floating-sel-rigor",
|
||||
"Rigor the floating selection.",
|
||||
"This procedure rigors the floating selection.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
NULL);
|
||||
"This procedure is deprecated!",
|
||||
"This procedure is deprecated!",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"NONE");
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_layer_id ("floating-sel",
|
||||
"floating sel",
|
||||
|
@ -369,12 +347,12 @@ register_floating_sel_procs (GimpPDB *pdb)
|
|||
"gimp-floating-sel-relax");
|
||||
gimp_procedure_set_static_strings (procedure,
|
||||
"gimp-floating-sel-relax",
|
||||
"Relax the floating selection.",
|
||||
"This procedure relaxes the floating selection.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
NULL);
|
||||
"This procedure is deprecated!",
|
||||
"This procedure is deprecated!",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"NONE");
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_layer_id ("floating-sel",
|
||||
"floating sel",
|
||||
|
|
|
@ -216,7 +216,6 @@ xcf_save_image (XcfInfo *info,
|
|||
GError **error)
|
||||
{
|
||||
GimpLayer *layer;
|
||||
GimpLayer *floating_layer;
|
||||
GimpChannel *channel;
|
||||
GList *list;
|
||||
guint32 saved_pos;
|
||||
|
@ -231,10 +230,6 @@ xcf_save_image (XcfInfo *info,
|
|||
gchar version_tag[16];
|
||||
GError *tmp_error = NULL;
|
||||
|
||||
floating_layer = gimp_image_floating_sel (image);
|
||||
if (floating_layer)
|
||||
floating_sel_relax (floating_layer, FALSE);
|
||||
|
||||
/* write out the tag information for the image */
|
||||
if (info->file_version > 0)
|
||||
{
|
||||
|
@ -379,9 +374,6 @@ xcf_save_image (XcfInfo *info,
|
|||
xcf_write_int32_check_error (info, &offset, 1);
|
||||
saved_pos = info->cp;
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, FALSE);
|
||||
|
||||
return !ferror (info->fp);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "gimp.h"
|
||||
#undef GIMP_DISABLE_DEPRECATED
|
||||
#undef __GIMP_FLOATING_SEL_PDB_H__
|
||||
#include "gimpfloatingsel_pdb.h"
|
||||
|
||||
/**
|
||||
* gimp_floating_sel_remove:
|
||||
|
@ -162,9 +165,7 @@ gimp_floating_sel_attach (gint32 layer_ID,
|
|||
* @floating_sel_ID: The floating selection.
|
||||
* @undo: .
|
||||
*
|
||||
* Rigor the floating selection.
|
||||
*
|
||||
* This procedure rigors the floating selection.
|
||||
* This procedure is deprecated!
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*/
|
||||
|
@ -194,9 +195,7 @@ gimp_floating_sel_rigor (gint32 floating_sel_ID,
|
|||
* @floating_sel_ID: The floating selection.
|
||||
* @undo: .
|
||||
*
|
||||
* Relax the floating selection.
|
||||
*
|
||||
* This procedure relaxes the floating selection.
|
||||
* This procedure is deprecated!
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*/
|
||||
|
|
|
@ -34,10 +34,12 @@ gboolean gimp_floating_sel_anchor (gint32 floating_sel_ID);
|
|||
gboolean gimp_floating_sel_to_layer (gint32 floating_sel_ID);
|
||||
gboolean gimp_floating_sel_attach (gint32 layer_ID,
|
||||
gint32 drawable_ID);
|
||||
#ifndef GIMP_DISABLE_DEPRECATED
|
||||
gboolean gimp_floating_sel_rigor (gint32 floating_sel_ID,
|
||||
gboolean undo);
|
||||
gboolean gimp_floating_sel_relax (gint32 floating_sel_ID,
|
||||
gboolean undo);
|
||||
#endif /* GIMP_DISABLE_DEPRECATED */
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -1667,7 +1667,6 @@ save_xjt_image (const gchar *filename,
|
|||
gint l_nchannels;
|
||||
gint32 l_layer_id;
|
||||
gint32 l_channel_id;
|
||||
gint32 l_floating_layer_id;
|
||||
gint32 l_selection_channel_id;
|
||||
int l_sel;
|
||||
gint32 l_x1, l_x2, l_y1, l_y2;
|
||||
|
@ -1676,7 +1675,6 @@ save_xjt_image (const gchar *filename,
|
|||
gint l_wr_all_prp;
|
||||
|
||||
l_rc = -1; /* init retcode to Errorstate */
|
||||
l_floating_layer_id = -1;
|
||||
l_fp_prp = NULL;
|
||||
l_layers_list = NULL;
|
||||
l_channels_list = NULL;
|
||||
|
@ -1735,15 +1733,6 @@ save_xjt_image (const gchar *filename,
|
|||
p_write_image_prp (l_dirname, l_fp_prp, image_id, l_wr_all_prp);
|
||||
|
||||
|
||||
l_floating_layer_id = gimp_image_get_floating_sel (image_id);
|
||||
if (l_floating_layer_id >= 0)
|
||||
{
|
||||
if (xjt_debug) printf ("XJT-DEBUG: call floating_sel_relax fsel_id=%d\n",
|
||||
(int) l_floating_layer_id);
|
||||
|
||||
gimp_floating_sel_relax (l_floating_layer_id, FALSE);
|
||||
}
|
||||
|
||||
l_layers_list = gimp_image_get_layers (image_id, &l_nlayers);
|
||||
|
||||
/* foreach layer do */
|
||||
|
@ -1907,14 +1896,6 @@ cleanup:
|
|||
fclose (l_fp_prp);
|
||||
}
|
||||
|
||||
if (l_floating_layer_id >= 0)
|
||||
{
|
||||
if (xjt_debug)
|
||||
printf("XJT-DEBUG: here we should call floating_sel_rigor sel_id=%d\n",
|
||||
(int)l_floating_layer_id);
|
||||
gimp_floating_sel_rigor (l_floating_layer_id, FALSE);
|
||||
}
|
||||
|
||||
g_free (l_layers_list);
|
||||
g_free (l_channels_list);
|
||||
|
||||
|
|
|
@ -160,10 +160,7 @@ CODE
|
|||
}
|
||||
|
||||
sub floating_sel_rigor {
|
||||
$blurb = 'Rigor the floating selection.';
|
||||
$help = 'This procedure rigors the floating selection.';
|
||||
|
||||
&std_pdb_misc;
|
||||
&std_pdb_deprecated ();
|
||||
|
||||
@inargs = (
|
||||
{ name => 'floating_sel', type => 'layer',
|
||||
|
@ -174,27 +171,13 @@ sub floating_sel_rigor {
|
|||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_layer_is_floating_sel (floating_sel))
|
||||
{
|
||||
floating_sel_rigor (floating_sel, undo);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
|
||||
_("Cannot rigor this layer because "
|
||||
"it is not a floating selection."));
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub floating_sel_relax {
|
||||
$blurb = 'Relax the floating selection.';
|
||||
$help = 'This procedure relaxes the floating selection.';
|
||||
|
||||
&std_pdb_misc;
|
||||
&std_pdb_deprecated ();
|
||||
|
||||
@inargs = (
|
||||
{ name => 'floating_sel', type => 'layer',
|
||||
|
@ -205,17 +188,6 @@ sub floating_sel_relax {
|
|||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (gimp_layer_is_floating_sel (floating_sel))
|
||||
{
|
||||
floating_sel_relax (floating_sel, undo);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
|
||||
_("Cannot relax this layer because "
|
||||
"it is not a floating selection."));
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
@ -227,8 +199,12 @@ CODE
|
|||
"gimppdb-utils.h"
|
||||
"gimp-intl.h");
|
||||
|
||||
@procs = qw(floating_sel_remove floating_sel_anchor floating_sel_to_layer
|
||||
floating_sel_attach floating_sel_rigor floating_sel_relax);
|
||||
@procs = qw(floating_sel_remove
|
||||
floating_sel_anchor
|
||||
floating_sel_to_layer
|
||||
floating_sel_attach
|
||||
floating_sel_rigor
|
||||
floating_sel_relax);
|
||||
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue