a little bit of tweaking.

2003-10-01  Simon Budig  <simon@gimp.org>

	* app/base/boundary.[ch]: a little bit of tweaking.

	* app/paint/gimppaintcore-stroke.c: Use it here too.
This commit is contained in:
Simon Budig 2003-10-01 01:01:26 +00:00 committed by Simon Budig
parent 6552547760
commit e4820b30bb
4 changed files with 21 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2003-10-01 Simon Budig <simon@gimp.org>
* app/base/boundary.[ch]: a little bit of tweaking.
* app/paint/gimppaintcore-stroke.c: Use it here too.
2003-10-01 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpsizeentry.c (gimp_size_entry_update_unit):

View File

@ -580,13 +580,14 @@ sort_boundary (const BoundSeg *segs,
/* sorted. */
BoundSeg *
simplify_boundary (const BoundSeg *stroke_segs,
gint num_groups,
gint *num_segs)
simplify_boundary (BoundSeg *stroke_segs,
gint num_groups,
gint *num_segs)
{
GArray *new_bounds;
GArray *points;
BoundSeg *ret_bounds;
BoundSeg tmp_seg;
gint i, j, seg, start, n_points;
g_return_val_if_fail (num_segs != NULL, NULL);
@ -613,17 +614,17 @@ simplify_boundary (const BoundSeg *stroke_segs,
{
points = g_array_new (FALSE, FALSE, sizeof (gint));
simplify_subdivide (stroke_segs, start, start + n_points - 1,
/* temporarily use the delimiter to close the polygon */
tmp_seg = stroke_segs[seg];
stroke_segs[seg] = stroke_segs[start];
simplify_subdivide (stroke_segs, start, start + n_points,
&points);
stroke_segs[seg] = tmp_seg;
for (j = 0; j < points->len; j++)
g_array_append_val (new_bounds,
stroke_segs [g_array_index (points, gint, j)]);
if (n_points > 1)
g_array_append_val (new_bounds,
stroke_segs [start + n_points - 1]);
g_array_append_val (new_bounds, stroke_segs[seg]);
g_array_free (points, TRUE);

View File

@ -53,7 +53,7 @@ BoundSeg * find_mask_boundary (PixelRegion *maskPR,
BoundSeg * sort_boundary (const BoundSeg *segs,
gint num_segs,
gint *num_groups);
BoundSeg * simplify_boundary (const BoundSeg *stroke_segs,
BoundSeg * simplify_boundary (BoundSeg *stroke_segs,
gint num_groups,
gint *num_segs);

View File

@ -90,6 +90,7 @@ gimp_paint_core_stroke_boundary (GimpPaintCore *core,
gint offset_y)
{
GimpImage *gimage;
BoundSeg *sorted_segs;
BoundSeg *stroke_segs;
gint n_stroke_segs;
gint off_x;
@ -107,7 +108,10 @@ 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);
sorted_segs = sort_boundary (bound_segs, n_bound_segs, &n_stroke_segs);
stroke_segs = simplify_boundary (sorted_segs, n_stroke_segs, &n_bound_segs);
g_free (sorted_segs);
if (n_stroke_segs == 0)
return TRUE;