Commit 805602b6 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

if the floating selection has no alpha, manually create BoundSegs of its

2005-09-08  Michael Natterer  <mitch@gimp.org>

	* app/core/gimplayer-floating-sel.c (floating_sel_boundary): if
	the floating selection has no alpha, manually create BoundSegs of
	its outline instead of calling boundary_find() (which creates a
	boundary of the last channel). Fixes bug #145373.

	* app/widgets/gimplayertreeview.c
	(gimp_layer_tree_view_floating_selection_changed): update all
	layer names' text attributes, not only for layers with alpha.
	Fixes layer name display when making a new layer out of a floating
	selection without alpha.
parent 7e34681f
2005-09-08 Michael Natterer <mitch@gimp.org>
* app/core/gimplayer-floating-sel.c (floating_sel_boundary): if
the floating selection has no alpha, manually create BoundSegs of
its outline instead of calling boundary_find() (which creates a
boundary of the last channel). Fixes bug #145373.
* app/widgets/gimplayertreeview.c
(gimp_layer_tree_view_floating_selection_changed): update all
layer names' text attributes, not only for layers with alpha.
Fixes layer name display when making a new layer out of a floating
selection without alpha.
2005-09-08 Michael Natterer <mitch@gimp.org> 2005-09-08 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainergridview.c * app/widgets/gimpcontainergridview.c
......
...@@ -524,28 +524,63 @@ floating_sel_boundary (GimpLayer *layer, ...@@ -524,28 +524,63 @@ floating_sel_boundary (GimpLayer *layer,
if (layer->fs.boundary_known == FALSE) if (layer->fs.boundary_known == FALSE)
{ {
gint width, height;
gint off_x, off_y;
width = gimp_item_width (GIMP_ITEM (layer));
height = gimp_item_height (GIMP_ITEM (layer));
gimp_item_offsets (GIMP_ITEM (layer), &off_x, &off_y);
if (layer->fs.segs) if (layer->fs.segs)
g_free (layer->fs.segs); g_free (layer->fs.segs);
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
{
/* find the segments */ /* find the segments */
pixel_region_init (&bPR, GIMP_DRAWABLE (layer)->tiles, pixel_region_init (&bPR, gimp_drawable_data (GIMP_DRAWABLE (layer)),
0, 0, 0, 0, width, height, FALSE);
GIMP_ITEM (layer)->width,
GIMP_ITEM (layer)->height, FALSE);
layer->fs.segs = boundary_find (&bPR, BOUNDARY_WITHIN_BOUNDS, layer->fs.segs = boundary_find (&bPR, BOUNDARY_WITHIN_BOUNDS,
0, 0, 0, 0, width, height,
GIMP_ITEM (layer)->width,
GIMP_ITEM (layer)->height,
BOUNDARY_HALF_WAY, BOUNDARY_HALF_WAY,
&layer->fs.num_segs); &layer->fs.num_segs);
/* offset the segments */ /* offset the segments */
for (i = 0; i < layer->fs.num_segs; i++) for (i = 0; i < layer->fs.num_segs; i++)
{ {
layer->fs.segs[i].x1 += GIMP_ITEM (layer)->offset_x; layer->fs.segs[i].x1 += off_x;
layer->fs.segs[i].y1 += GIMP_ITEM (layer)->offset_y; layer->fs.segs[i].y1 += off_y;
layer->fs.segs[i].x2 += GIMP_ITEM (layer)->offset_x; layer->fs.segs[i].x2 += off_x;
layer->fs.segs[i].y2 += GIMP_ITEM (layer)->offset_y; layer->fs.segs[i].y2 += off_y;
}
}
else
{
layer->fs.num_segs = 4;
layer->fs.segs = g_new0 (BoundSeg, 4);
/* top */
layer->fs.segs[0].x1 = off_x;
layer->fs.segs[0].y1 = off_y;
layer->fs.segs[0].x2 = off_x + width;
layer->fs.segs[0].y2 = off_y;
/* left */
layer->fs.segs[1].x1 = off_x;
layer->fs.segs[1].y1 = off_y;
layer->fs.segs[1].x2 = off_x;
layer->fs.segs[1].y2 = off_y + height;
/* right */
layer->fs.segs[2].x1 = off_x + width;
layer->fs.segs[2].y1 = off_y;
layer->fs.segs[2].x2 = off_x + width;
layer->fs.segs[2].y2 = off_y + height;
/* bottom */
layer->fs.segs[3].x1 = off_x;
layer->fs.segs[3].y1 = off_y + height;
layer->fs.segs[3].x2 = off_x + width;
layer->fs.segs[3].y2 = off_y + height;
} }
layer->fs.boundary_known = TRUE; layer->fs.boundary_known = TRUE;
......
...@@ -917,19 +917,16 @@ gimp_layer_tree_view_floating_selection_changed (GimpImage *gimage, ...@@ -917,19 +917,16 @@ gimp_layer_tree_view_floating_selection_changed (GimpImage *gimage,
{ {
GimpDrawable *drawable = list->data; GimpDrawable *drawable = list->data;
if (gimp_drawable_has_alpha (drawable)) iter = gimp_container_view_lookup (view, (GimpViewable *) drawable);
{
iter = gimp_container_view_lookup (view,
(GimpViewable *) drawable);
if (iter) if (iter)
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter, gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
tree_view->model_column_name_attributes, tree_view->model_column_name_attributes,
NULL, gimp_drawable_has_alpha (drawable) ?
NULL : layer_view->bold_attrs,
-1); -1);
} }
} }
}
} }
......
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