mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
graphics: Calc capacity of vertices
This commit is contained in:
parent
fb4ac5cd56
commit
fbf6b6c525
@ -126,7 +126,14 @@ func (q *commandQueue) Flush(context *opengl.Context) error {
|
||||
// glViewport must be called at least at every frame on iOS.
|
||||
context.ResetViewportSize()
|
||||
for _, g := range q.commandGroups() {
|
||||
vertices := []int16{}
|
||||
n := 0
|
||||
for _, c := range g {
|
||||
switch c := c.(type) {
|
||||
case *drawImageCommand:
|
||||
n += len(c.vertices)
|
||||
}
|
||||
}
|
||||
vertices := make([]int16, 0, n)
|
||||
for _, c := range g {
|
||||
switch c := c.(type) {
|
||||
case *drawImageCommand:
|
||||
|
Loading…
Reference in New Issue
Block a user