Reverted changes on setlen

This commit is contained in:
Ben Cragg 2019-04-24 10:32:35 +01:00
parent d48ef44bdc
commit 159df28dcc
1 changed files with 2 additions and 7 deletions

View File

@ -50,15 +50,10 @@ func (td *TrianglesData) Len() int {
// values ((0, 0), white, (0, 0), 0).
func (td *TrianglesData) SetLen(len int) {
if len > td.Len() {
newTD := make(TrianglesData, len)
copy(newTD, *td)
needAppend := len - td.Len()
for i := td.Len(); i < needAppend; i++ {
newTD[i] = zeroValueTriangleData
for i := 0; i < needAppend; i++ {
*td = append(*td, zeroValueTriangleData)
}
*td = newTD
}
if len < td.Len() {
*td = (*td)[:len]