Skip to content

Commit

Permalink
Reduce loop vars
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonynsimon committed Sep 18, 2016
1 parent 529d352 commit e0cf766
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions paint/fill.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -133,10 +133,7 @@ func FloodFill(img image.Image, sp image.Point, c color.Color, fuzz float64) *im
}
}
}

}

pointsRemaining = st.Len() > 0
}

return im
Expand Down

0 comments on commit e0cf766

Please sign in to comment.