SetSizes sets the max number of groups along each dimension (X, Y), so total number of groups is X*Y, and max items per group, and item sizes to organize -- directly uses the given slice so it should not be something that is reallocated.
(gps image.Point, itmsPerGp int, itms []image.Point)
| 81 | // and item sizes to organize -- directly uses the given slice |
| 82 | // so it should not be something that is reallocated. |
| 83 | func (sa *SzAlloc) SetSizes(gps image.Point, itmsPerGp int, itms []image.Point) { |
| 84 | sa.MaxGps = gps |
| 85 | sa.MaxNGps = Area(gps) |
| 86 | sa.MaxItemsPerGp = itmsPerGp |
| 87 | sa.ItemSizes = itms |
| 88 | } |
| 89 | |
| 90 | func Area(sz image.Point) int { |
| 91 | return sz.X * sz.Y |