Commit 4fb1743f authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

renamed puclic functions, defines and enums to live in a proper "boundary"

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

	* app/base/boundary.[ch]: renamed puclic functions, defines and
	enums to live in a proper "boundary" namespace. Cleaned up and
	simplified internal code even more.

	* app/core/gimpchannel.c
	* app/core/gimpdrawable-stroke.c
	* app/core/gimplayer-floating-sel.c
	* app/paint/gimppaintcore-stroke.c
	* app/tools/gimpeditselectiontool.c
	* app/tools/gimpfuzzyselecttool.c
	* app/tools/gimppainttool.c: changed accordingly.
parent e923e0a5
2005-08-20 Michael Natterer <mitch@gimp.org>
* app/base/boundary.[ch]: renamed puclic functions, defines and
enums to live in a proper "boundary" namespace. Cleaned up and
simplified internal code even more.
* app/core/gimpchannel.c
* app/core/gimpdrawable-stroke.c
* app/core/gimplayer-floating-sel.c
* app/paint/gimppaintcore-stroke.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpfuzzyselecttool.c
* app/tools/gimppainttool.c: changed accordingly.
2005-08-20 Michael Natterer <mitch@gimp.org>
* app/base/boundary.c: rename local "ns" variables to "num_segs"
......
This diff is collapsed.
......@@ -21,13 +21,13 @@
/* half intensity for mask */
#define HALF_WAY 127
#define BOUNDARY_HALF_WAY 127
typedef enum
{
WithinBounds,
IgnoreBounds
BOUNDARY_WITHIN_BOUNDS,
BOUNDARY_IGNORE_BOUNDS
} BoundaryType;
......@@ -42,18 +42,18 @@ struct _BoundSeg
};
BoundSeg * find_mask_boundary (PixelRegion *maskPR,
gint *num_elems,
BoundSeg * boundary_find (PixelRegion *maskPR,
BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2,
guchar threshold);
BoundSeg * sort_boundary (const BoundSeg *segs,
guchar threshold,
gint *num_segs);
BoundSeg * boundary_sort (const BoundSeg *segs,
gint num_segs,
gint *num_groups);
BoundSeg * simplify_boundary (BoundSeg *stroke_segs,
BoundSeg * boundary_simplify (BoundSeg *stroke_segs,
gint num_groups,
gint *num_segs);
......
......@@ -919,11 +919,10 @@ gimp_channel_real_boundary (GimpChannel *channel,
pixel_region_init (&bPR, GIMP_DRAWABLE (channel)->tiles,
x3, y3, x4 - x3, y4 - y3, FALSE);
channel->segs_out = find_mask_boundary (&bPR, &channel->num_segs_out,
IgnoreBounds,
x1, y1,
x2, y2,
HALF_WAY);
channel->segs_out = boundary_find (&bPR, BOUNDARY_IGNORE_BOUNDS,
x1, y1, x2, y2,
BOUNDARY_HALF_WAY,
&channel->num_segs_out);
x1 = MAX (x1, x3);
y1 = MAX (y1, y3);
x2 = MIN (x2, x4);
......@@ -936,11 +935,10 @@ gimp_channel_real_boundary (GimpChannel *channel,
GIMP_ITEM (channel)->width,
GIMP_ITEM (channel)->height, FALSE);
channel->segs_in = find_mask_boundary (&bPR, &channel->num_segs_in,
WithinBounds,
x1, y1,
x2, y2,
HALF_WAY);
channel->segs_in = boundary_find (&bPR, BOUNDARY_WITHIN_BOUNDS,
x1, y1, x2, y2,
BOUNDARY_HALF_WAY,
&channel->num_segs_in);
}
else
{
......
......@@ -84,7 +84,7 @@ gimp_drawable_stroke_boundary (GimpDrawable *drawable,
g_return_if_fail (bound_segs != NULL);
stroke_segs = sort_boundary (bound_segs, n_bound_segs, &n_stroke_segs);
stroke_segs = boundary_sort (bound_segs, n_bound_segs, &n_stroke_segs);
if (n_stroke_segs == 0)
return;
......
......@@ -532,11 +532,12 @@ floating_sel_boundary (GimpLayer *layer,
0, 0,
GIMP_ITEM (layer)->width,
GIMP_ITEM (layer)->height, FALSE);
layer->fs.segs = find_mask_boundary (&bPR, &layer->fs.num_segs,
WithinBounds, 0, 0,
GIMP_ITEM (layer)->width,
GIMP_ITEM (layer)->height,
HALF_WAY);
layer->fs.segs = boundary_find (&bPR, BOUNDARY_WITHIN_BOUNDS,
0, 0,
GIMP_ITEM (layer)->width,
GIMP_ITEM (layer)->height,
BOUNDARY_HALF_WAY,
&layer->fs.num_segs);
/* offset the segments */
for (i = 0; i < layer->fs.num_segs; i++)
......
......@@ -109,7 +109,7 @@ gimp_paint_core_stroke_boundary (GimpPaintCore *core,
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
stroke_segs = sort_boundary (bound_segs, n_bound_segs, &n_stroke_segs);
stroke_segs = boundary_sort (bound_segs, n_bound_segs, &n_stroke_segs);
if (n_stroke_segs == 0)
return TRUE;
......
......@@ -795,16 +795,17 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
PR.bytes = mask->bytes;
PR.rowstride = PR.w * PR.bytes;
boundary =
find_mask_boundary (&PR, &brush_core->n_brush_bound_segs,
WithinBounds,
0, 0,
PR.w, PR.h,
0);
boundary = boundary_find (&PR, BOUNDARY_WITHIN_BOUNDS,
0, 0, PR.w, PR.h,
0,
&brush_core->n_brush_bound_segs);
brush_core->brush_bound_segs =
sort_boundary (boundary,
brush_core->n_brush_bound_segs, &num_groups);
boundary_sort (boundary, brush_core->n_brush_bound_segs,
&num_groups);
brush_core->n_brush_bound_segs += num_groups;
g_free (boundary);
brush_core->brush_bound_width = mask->width;
......
......@@ -296,11 +296,11 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
&edit_select->num_segs_in, &edit_select->num_segs_out,
0, 0, 0, 0);
edit_select->segs_in = sort_boundary (segs_in, edit_select->num_segs_in,
edit_select->segs_in = boundary_sort (segs_in, edit_select->num_segs_in,
&num_groups);
edit_select->num_segs_in += num_groups;
edit_select->segs_out = sort_boundary (segs_out, edit_select->num_segs_out,
edit_select->segs_out = boundary_sort (segs_out, edit_select->num_segs_out,
&num_groups);
edit_select->num_segs_out += num_groups;
......
......@@ -425,12 +425,12 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel,
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
FALSE);
bsegs =
find_mask_boundary (&maskPR, num_segs, WithinBounds,
0, 0,
gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
HALF_WAY);
bsegs = boundary_find (&maskPR, BOUNDARY_WITHIN_BOUNDS,
0, 0,
gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
BOUNDARY_HALF_WAY,
num_segs);
segs = g_new (GdkSegment, *num_segs);
......
......@@ -795,16 +795,17 @@ gimp_paint_tool_draw (GimpDrawTool *draw_tool)
PR.bytes = mask->bytes;
PR.rowstride = PR.w * PR.bytes;
boundary =
find_mask_boundary (&PR, &brush_core->n_brush_bound_segs,
WithinBounds,
0, 0,
PR.w, PR.h,
0);
boundary = boundary_find (&PR, BOUNDARY_WITHIN_BOUNDS,
0, 0, PR.w, PR.h,
0,
&brush_core->n_brush_bound_segs);
brush_core->brush_bound_segs =
sort_boundary (boundary,
brush_core->n_brush_bound_segs, &num_groups);
boundary_sort (boundary, brush_core->n_brush_bound_segs,
&num_groups);
brush_core->n_brush_bound_segs += num_groups;
g_free (boundary);
brush_core->brush_bound_width = mask->width;
......
......@@ -425,12 +425,12 @@ gimp_fuzzy_select_tool_calculate (GimpFuzzySelectTool *fuzzy_sel,
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
FALSE);
bsegs =
find_mask_boundary (&maskPR, num_segs, WithinBounds,
0, 0,
gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
HALF_WAY);
bsegs = boundary_find (&maskPR, BOUNDARY_WITHIN_BOUNDS,
0, 0,
gimp_item_width (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
gimp_item_height (GIMP_ITEM (fuzzy_sel->fuzzy_mask)),
BOUNDARY_HALF_WAY,
num_segs);
segs = g_new (GdkSegment, *num_segs);
......
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