Commit 39156015 authored by Michael Natterer's avatar Michael Natterer 😴

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.
parent bbc83d33
......@@ -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;
segs = gimp_layer_boundary (layer, &selection->num_segs_layer);
g_free (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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment