allocSizes allocates the sprites by size to fixed set of images and layers
()
| 164 | |
| 165 | // allocSizes allocates the sprites by size to fixed set of images and layers |
| 166 | func (ss *Sprites) allocSizes() { |
| 167 | ns := ss.Names.Len() |
| 168 | szs := make([]image.Point, ns) |
| 169 | idx := 0 |
| 170 | for _, kv := range ss.Names.Order { |
| 171 | sp := kv.Value |
| 172 | if sp.Geom.Size == (image.Point{}) { |
| 173 | continue |
| 174 | } |
| 175 | szs[idx] = sp.Geom.Size |
| 176 | idx++ |
| 177 | } |
| 178 | if idx != ns { |
| 179 | szs = szs[:idx] |
| 180 | } |
| 181 | ss.szAlloc.SetSizes(image.Point{4, 4}, system.MaxImageLayers, szs) |
| 182 | ss.szAlloc.Alloc() |
| 183 | } |
| 184 | |
| 185 | // Add adds sprite to list, and returns the image index and |
| 186 | // layer index within that for given sprite. If name already |
no test coverage detected