graphicsdriver/metal: Refactoring: Use NextPowerOf2Int

This commit is contained in:
Hajime Hoshi 2019-02-14 11:09:16 +09:00
parent a1b1bce43a
commit a6d3a1e0cb

View File

@ -580,12 +580,9 @@ func (d *Driver) Draw(indexLen int, indexOffset int, mode graphics.CompositeMode
viewportSize := [...]float32{float32(w), float32(h)}
rce.SetVertexBytes(unsafe.Pointer(&viewportSize[0]), unsafe.Sizeof(viewportSize), 1)
sourceSize := [...]float32{float32(1), float32(1)}
for sourceSize[0] < float32(d.src.width) {
sourceSize[0] *= 2
}
for sourceSize[1] < float32(d.src.height) {
sourceSize[1] *= 2
sourceSize := [...]float32{
float32(graphics.NextPowerOf2Int(d.src.width)),
float32(graphics.NextPowerOf2Int(d.src.height)),
}
rce.SetFragmentBytes(unsafe.Pointer(&sourceSize[0]), unsafe.Sizeof(sourceSize), 2)