dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 697752ef8242c3120de434fe309e578501b8394a
parent 8fa1fdc6d9d8ce688044a8ef8251387e46f9abbd
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sat, 27 May 2023 22:29:59 -0700

avoid allocs

Diffstat:
Mpkg/captcha/image.go | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkg/captcha/image.go b/pkg/captcha/image.go @@ -676,10 +676,10 @@ func (m *Image) renderPath(points []Point) { func (m *Image) renderFakePath(points []Point) { d := m.CubicDelta - gradColors := make([]color.RGBA, 0) - for i := 0; i < len(points); i++ { - gradColors = append(gradColors, m.getLineColor()) - gradColors = append(gradColors, m.getLineColor()) + gradColors := make([]color.RGBA, len(points)*2) + for i := 0; i < len(points)*2; i += 2 { + gradColors[i] = m.getLineColor() + gradColors[i+1] = m.getLineColor() } if m.renderHelpImg {