From 1329aa51b605cb54ba9aae3a82a0a87b881fb7b3 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 13 Nov 2017 09:09:58 -0800 Subject: Updating server dependancies. (#7816) --- vendor/github.com/disintegration/imaging/resize.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'vendor/github.com/disintegration/imaging/resize.go') diff --git a/vendor/github.com/disintegration/imaging/resize.go b/vendor/github.com/disintegration/imaging/resize.go index 1659bbce8..cd5bfb5d8 100644 --- a/vendor/github.com/disintegration/imaging/resize.go +++ b/vendor/github.com/disintegration/imaging/resize.go @@ -19,6 +19,7 @@ func precomputeWeights(dstSize, srcSize int, filter ResampleFilter) [][]indexWei ru := math.Ceil(scale * filter.Support) out := make([][]indexWeight, dstSize) + tmp := make([]indexWeight, 0, dstSize*int(ru+2)*2) for v := 0; v < dstSize; v++ { fu := (float64(v)+0.5)*du - 0.5 @@ -37,14 +38,17 @@ func precomputeWeights(dstSize, srcSize int, filter ResampleFilter) [][]indexWei w := filter.Kernel((float64(u) - fu) / scale) if w != 0 { sum += w - out[v] = append(out[v], indexWeight{index: u, weight: w}) + tmp = append(tmp, indexWeight{index: u, weight: w}) } } if sum != 0 { - for i := range out[v] { - out[v][i].weight /= sum + for i := range tmp { + tmp[i].weight /= sum } } + + out[v] = tmp + tmp = tmp[len(tmp):] } return out -- cgit v1.2.3-1-g7c22