From e0cf76671e27b7de935b03571f0449db4b268356 Mon Sep 17 00:00:00 2001 From: "Anthony N. Simon" Date: Sun, 18 Sep 2016 21:15:19 +0200 Subject: [PATCH] Reduce loop vars --- paint/fill.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/paint/fill.go b/paint/fill.go index d5f65fb..2e51b77 100644 --- a/paint/fill.go +++ b/paint/fill.go @@ -42,9 +42,9 @@ func FloodFill(img image.Image, sp image.Point, c color.Color, fuzz float64) *im matchColor := color.NRGBAModel.Convert(im.At(sp.X, sp.Y)).(color.NRGBA) st.Push(fillPoint{sp.X, sp.Y, true, true, 0, 0}) - pointsRemaining := st.Len() > 0 - for pointsRemaining { + // loop until there are no more points remaining + for st.Len() > 0 { point = st.Pop().(fillPoint) pixOffset := im.PixOffset(point.X, point.Y) @@ -133,10 +133,7 @@ func FloodFill(img image.Image, sp image.Point, c color.Color, fuzz float64) *im } } } - } - - pointsRemaining = st.Len() > 0 } return im