mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/graphics: Refactoring
This commit is contained in:
parent
26b9fa20c1
commit
15a0c53918
@ -63,6 +63,9 @@ type verticesBackend struct {
|
|||||||
m sync.Mutex
|
m sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// slice returns a float32 slice for n vertices.
|
||||||
|
// slice returns a slice that never overlaps with other slices returned this function,
|
||||||
|
// and users can do optimization based on this fact.
|
||||||
func (v *verticesBackend) slice(n int) []float32 {
|
func (v *verticesBackend) slice(n int) []float32 {
|
||||||
v.m.Lock()
|
v.m.Lock()
|
||||||
defer v.m.Unlock()
|
defer v.m.Unlock()
|
||||||
@ -95,7 +98,7 @@ func QuadVertices(sx0, sy0, sx1, sy1 float32, a, b, c, d, tx, ty float32, cr, cg
|
|||||||
vs := theVerticesBackend.slice(4)
|
vs := theVerticesBackend.slice(4)
|
||||||
|
|
||||||
// This function is very performance-sensitive and implement in a very dumb way.
|
// This function is very performance-sensitive and implement in a very dumb way.
|
||||||
_ = vs[:32]
|
_ = vs[:4*VertexFloatNum]
|
||||||
|
|
||||||
vs[0] = tx
|
vs[0] = tx
|
||||||
vs[1] = ty
|
vs[1] = ty
|
||||||
|
Loading…
Reference in New Issue
Block a user