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

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,29 +524,64 @@ floating_sel_boundary (GimpLayer *layer, ...@@ -524,29 +524,64 @@ 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);
/* find the segments */ if (gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
pixel_region_init (&bPR, GIMP_DRAWABLE (layer)->tiles, {
0, 0, /* find the segments */
GIMP_ITEM (layer)->width, pixel_region_init (&bPR, gimp_drawable_data (GIMP_DRAWABLE (layer)),
GIMP_ITEM (layer)->height, FALSE); 0, 0, width, 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, BOUNDARY_HALF_WAY,
GIMP_ITEM (layer)->height, &layer->fs.num_segs);
BOUNDARY_HALF_WAY,
&layer->fs.num_segs); /* offset the segments */
for (i = 0; i < layer->fs.num_segs; i++)
/* offset the segments */ {
for (i = 0; i < layer->fs.num_segs; i++) layer->fs.segs[i].x1 += off_x;
{ layer->fs.segs[i].y1 += off_y;
layer->fs.segs[i].x1 += GIMP_ITEM (layer)->offset_x; layer->fs.segs[i].x2 += off_x;
layer->fs.segs[i].y1 += GIMP_ITEM (layer)->offset_y; layer->fs.segs[i].y2 += off_y;
layer->fs.segs[i].x2 += GIMP_ITEM (layer)->offset_x; }
layer->fs.segs[i].y2 += GIMP_ITEM (layer)->offset_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,17 +917,14 @@ gimp_layer_tree_view_floating_selection_changed (GimpImage *gimage, ...@@ -917,17 +917,14 @@ 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, if (iter)
(GimpViewable *) drawable); gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter,
tree_view->model_column_name_attributes,
if (iter) gimp_drawable_has_alpha (drawable) ?
gtk_list_store_set (GTK_LIST_STORE (tree_view->model), iter, NULL : layer_view->bold_attrs,
tree_view->model_column_name_attributes, -1);
NULL,
-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