Make layer masks work consistently on layers without alpha. Fixes bug

2007-09-15  Michael Natterer  <mitch@gimp.org>

	Make layer masks work consistently on layers without alpha.
	Fixes bug #475548.

	* app/core/gimplayer.c (gimp_layer_apply_mask): changed to work
	on layers without alpha.

	* app/actions/layers-commands.c (layers_add_mask_response): don't
	automatically add an alpha channel when adding a layer mask.


svn path=/trunk/; revision=23555
This commit is contained in:
Michael Natterer 2007-09-15 19:23:20 +00:00 committed by Michael Natterer
parent 3eaea89ebb
commit 08d38cea82
3 changed files with 19 additions and 5 deletions

View File

@ -1,3 +1,14 @@
2007-09-15 Michael Natterer <mitch@gimp.org>
Make layer masks work consistently on layers without alpha.
Fixes bug #475548.
* app/core/gimplayer.c (gimp_layer_apply_mask): changed to work
on layers without alpha.
* app/actions/layers-commands.c (layers_add_mask_response): don't
automatically add an alpha channel when adding a layer mask.
2007-09-14 Michael Natterer <mitch@gimp.org>
* libgimpbase/gimpdatafiles.c: move private functions to the end

View File

@ -990,9 +990,6 @@ layers_add_mask_response (GtkWidget *widget,
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_LAYER_ADD_MASK,
_("Add Layer Mask"));
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
gimp_layer_add_alpha (layer);
mask = gimp_layer_create_mask (layer, layer_add_mask_type,
dialog->channel);

View File

@ -1491,9 +1491,9 @@ gimp_layer_apply_mask (GimpLayer *layer,
if (! layer->mask)
return;
/* this operation can only be done to layers with an alpha channel */
/* APPLY can only be done to layers with an alpha channel */
if (! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
return;
g_return_if_fail (mode == GIMP_MASK_DISCARD || push_undo == TRUE);
item = GIMP_ITEM (layer);
@ -1510,6 +1510,12 @@ gimp_layer_apply_mask (GimpLayer *layer,
_("Delete Layer Mask"));
gimp_image_undo_push_layer_mask_remove (image, NULL, layer, layer->mask);
if (mode == GIMP_MASK_APPLY &&
! gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
{
gimp_layer_add_alpha (layer);
}
}
/* check if applying the mask changes the projection */