dkforest

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

commit 88703b52e3c3dc961fa3e9fe59744be659be168f
parent 3fdd4b2ce5003897a29825c4fcb5779b8a55f042
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sat, 27 May 2023 22:43:33 -0700

reduce 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 @@ -593,10 +593,10 @@ func getGradient(p1, p2 Point, gradColors []color.RGBA, i int) gg.Gradient { func (m *Image) renderPath(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() } m.withState(func() {