mirror of https://github.com/GNOME/gimp.git
Remove gimp_image_layer_boundary()
Having a function that only abstracts whether there is an active layer or not is pretty useless. This also doesn't make the code in selection_generate_segs() more complex but rather more obvious.
This commit is contained in:
parent
bbc83d33b5
commit
3915601544
|
@ -4083,35 +4083,6 @@ gimp_image_reorder_vectors (GimpImage *image,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_image_layer_boundary (const GimpImage *image,
|
||||
BoundSeg **segs,
|
||||
gint *n_segs)
|
||||
{
|
||||
GimpLayer *layer;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||
g_return_val_if_fail (segs != NULL, FALSE);
|
||||
g_return_val_if_fail (n_segs != NULL, FALSE);
|
||||
|
||||
/* The second boundary corresponds to the active layer's
|
||||
* perimeter...
|
||||
*/
|
||||
layer = gimp_image_get_active_layer (image);
|
||||
|
||||
if (layer)
|
||||
{
|
||||
*segs = gimp_layer_boundary (layer, n_segs);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*segs = NULL;
|
||||
*n_segs = 0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
GimpLayer *
|
||||
gimp_image_pick_layer (const GimpImage *image,
|
||||
gint x,
|
||||
|
|
|
@ -554,9 +554,6 @@ gboolean gimp_image_reorder_vectors (GimpImage *image,
|
|||
gboolean push_undo,
|
||||
const gchar *undo_desc);
|
||||
|
||||
gboolean gimp_image_layer_boundary (const GimpImage *image,
|
||||
BoundSeg **segs,
|
||||
gint *n_segs);
|
||||
GimpLayer * gimp_image_pick_layer (const GimpImage *image,
|
||||
gint x,
|
||||
gint y);
|
||||
|
|
|
@ -611,14 +611,15 @@ selection_transform_segs (Selection *selection,
|
|||
static void
|
||||
selection_generate_segs (Selection *selection)
|
||||
{
|
||||
GimpImage *image = selection->shell->display->image;
|
||||
const BoundSeg *segs_in;
|
||||
const BoundSeg *segs_out;
|
||||
BoundSeg *segs_layer;
|
||||
GimpLayer *layer;
|
||||
|
||||
/* Ask the image for the boundary of its selected region...
|
||||
* Then transform that information into a new buffer of GdkSegments
|
||||
*/
|
||||
gimp_channel_boundary (gimp_image_get_mask (selection->shell->display->image),
|
||||
gimp_channel_boundary (gimp_image_get_mask (image),
|
||||
&segs_in, &segs_out,
|
||||
&selection->num_segs_in, &selection->num_segs_out,
|
||||
0, 0, 0, 0);
|
||||
|
@ -650,23 +651,25 @@ selection_generate_segs (Selection *selection)
|
|||
selection->segs_out = NULL;
|
||||
}
|
||||
|
||||
/* The active layer's boundary */
|
||||
gimp_image_layer_boundary (selection->shell->display->image,
|
||||
&segs_layer, &selection->num_segs_layer);
|
||||
layer = gimp_image_get_active_layer (image);
|
||||
|
||||
if (selection->num_segs_layer)
|
||||
if (layer)
|
||||
{
|
||||
selection->segs_layer = g_new (GdkSegment, selection->num_segs_layer);
|
||||
selection_transform_segs (selection, segs_layer,
|
||||
selection->segs_layer,
|
||||
selection->num_segs_layer);
|
||||
}
|
||||
else
|
||||
{
|
||||
selection->segs_layer = NULL;
|
||||
}
|
||||
BoundSeg *segs;
|
||||
|
||||
g_free (segs_layer);
|
||||
segs = gimp_layer_boundary (layer, &selection->num_segs_layer);
|
||||
|
||||
if (selection->num_segs_layer)
|
||||
{
|
||||
selection->segs_layer = g_new (GdkSegment, selection->num_segs_layer);
|
||||
|
||||
selection_transform_segs (selection, segs,
|
||||
selection->segs_layer,
|
||||
selection->num_segs_layer);
|
||||
|
||||
g_free (segs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue