graphicsutil: Optimization to avoid boundary checks

This commit is contained in:
Hajime Hoshi 2018-06-23 03:18:54 +09:00
parent 6c1c60d40d
commit 33e4f82d7c

View File

@ -69,7 +69,9 @@ func QuadVertices(width, height int, sx0, sy0, sx1, sy1 int, a, b, c, d, tx, ty
}
func quadVerticesImpl(x, y, u0, v0, u1, v1, a, b, c, d, tx, ty float32) []float32 {
vs := theVerticesBackend.sliceForOneQuad()
// Specifying a range explicitly here is redundant but this helps optimization
// to eliminate boundry checks.
vs := theVerticesBackend.sliceForOneQuad()[0:24]
ax, by, cx, dy := a*x, b*y, c*x, d*y