Bill Skaggs <weskaggs@primate.ucdavis.edu>

* app/tools/gimptransformtool.c
	* app/tools/gimpfliptool.c
	* app/core/gimpdrawabletransform.c: avoid messages and critical
	error when transforming a drawable that does not intersect
	the selection.
This commit is contained in:
William Skaggs 2005-03-21 22:47:06 +00:00
parent e87f6dcc14
commit 1cc9701bed
5 changed files with 77 additions and 39 deletions

View File

@ -1,3 +1,11 @@
2005-03-21 Bill Skaggs <weskaggs@primate.ucdavis.edu>
* app/tools/gimptransformtool.c
* app/tools/gimpfliptool.c
* app/core/gimpdrawabletransform.c: avoid messages and critical
error when transforming a drawable that does not intersect
the selection.
2005-03-21 Sven Neumann <sven@gimp.org>
* app/paint/gimpink.c: changed time-smoother code to use guint32

View File

@ -976,7 +976,7 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
if (orig_tiles)
{
TileManager *new_tiles;
TileManager *new_tiles = NULL;
if (auto_center)
{
@ -1007,13 +1007,16 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
clip_result = TRUE;
/* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_flip (drawable, context,
orig_tiles,
flip_type, axis,
clip_result);
if (orig_tiles)
{
new_tiles = gimp_drawable_transform_tiles_flip (drawable, context,
orig_tiles,
flip_type, axis,
clip_result);
/* Free the cut/copied buffer */
tile_manager_unref (orig_tiles);
/* Free the cut/copied buffer */
tile_manager_unref (orig_tiles);
}
if (new_tiles)
{
@ -1118,14 +1121,24 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
/* extract the selected mask if there is a selection */
if (! gimp_channel_is_empty (gimp_image_get_mask (gimage)))
{
gint x, y, w, h;
/* set the keep_indexed flag to FALSE here, since we use
* gimp_layer_new_from_tiles() later which assumes that the tiles
* are either RGB or GRAY. Eeek!!! (Sven)
*/
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
drawable, context, TRUE, FALSE, TRUE);
if (gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h))
{
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
drawable, context, TRUE, FALSE, TRUE);
*new_layer = TRUE;
*new_layer = TRUE;
}
else
{
tiles = NULL;
*new_layer = FALSE;
}
}
else /* otherwise, just copy the layer */
{

View File

@ -976,7 +976,7 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
if (orig_tiles)
{
TileManager *new_tiles;
TileManager *new_tiles = NULL;
if (auto_center)
{
@ -1007,13 +1007,16 @@ gimp_drawable_transform_flip (GimpDrawable *drawable,
clip_result = TRUE;
/* transform the buffer */
new_tiles = gimp_drawable_transform_tiles_flip (drawable, context,
orig_tiles,
flip_type, axis,
clip_result);
if (orig_tiles)
{
new_tiles = gimp_drawable_transform_tiles_flip (drawable, context,
orig_tiles,
flip_type, axis,
clip_result);
/* Free the cut/copied buffer */
tile_manager_unref (orig_tiles);
/* Free the cut/copied buffer */
tile_manager_unref (orig_tiles);
}
if (new_tiles)
{
@ -1118,14 +1121,24 @@ gimp_drawable_transform_cut (GimpDrawable *drawable,
/* extract the selected mask if there is a selection */
if (! gimp_channel_is_empty (gimp_image_get_mask (gimage)))
{
gint x, y, w, h;
/* set the keep_indexed flag to FALSE here, since we use
* gimp_layer_new_from_tiles() later which assumes that the tiles
* are either RGB or GRAY. Eeek!!! (Sven)
*/
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
drawable, context, TRUE, FALSE, TRUE);
if (gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h))
{
tiles = gimp_selection_extract (gimp_image_get_mask (gimage),
drawable, context, TRUE, FALSE, TRUE);
*new_layer = TRUE;
*new_layer = TRUE;
}
else
{
tiles = NULL;
*new_layer = FALSE;
}
}
else /* otherwise, just copy the layer */
{

View File

@ -272,11 +272,12 @@ gimp_flip_tool_transform (GimpTransformTool *trans_tool,
{
case GIMP_TRANSFORM_TYPE_LAYER:
case GIMP_TRANSFORM_TYPE_SELECTION:
ret = gimp_drawable_transform_tiles_flip (GIMP_DRAWABLE (active_item),
context,
trans_tool->original,
options->flip_type, axis,
FALSE);
if (trans_tool->original)
ret = gimp_drawable_transform_tiles_flip (GIMP_DRAWABLE (active_item),
context,
trans_tool->original,
options->flip_type, axis,
FALSE);
break;
case GIMP_TRANSFORM_TYPE_PATH:

View File

@ -901,21 +901,24 @@ gimp_transform_tool_real_transform (GimpTransformTool *tr_tool,
/* always clip the selction and unfloated channels
* so they keep their size
*/
if (GIMP_IS_CHANNEL (active_item) &&
tile_manager_bpp (tr_tool->original) == 1)
clip_result = TRUE;
if (tr_tool->original)
{
if (GIMP_IS_CHANNEL (active_item) &&
tile_manager_bpp (tr_tool->original) == 1)
clip_result = TRUE;
ret =
gimp_drawable_transform_tiles_affine (GIMP_DRAWABLE (active_item),
context,
tr_tool->original,
&tr_tool->transform,
options->direction,
options->interpolation,
options->supersample,
options->recursion_level,
clip_result,
progress);
ret =
gimp_drawable_transform_tiles_affine (GIMP_DRAWABLE (active_item),
context,
tr_tool->original,
&tr_tool->transform,
options->direction,
options->interpolation,
options->supersample,
options->recursion_level,
clip_result,
progress);
}
}
break;