2017-07-02 12:04:20 -05:00
|
|
|
package pixel_test
|
|
|
|
|
|
|
|
import (
|
2017-07-02 17:22:45 -05:00
|
|
|
"image"
|
2017-07-02 12:04:20 -05:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/faiface/pixel"
|
|
|
|
)
|
|
|
|
|
|
|
|
func BenchmarkSpriteDrawBatch(b *testing.B) {
|
2017-07-02 17:22:45 -05:00
|
|
|
img := image.NewRGBA(image.Rect(0, 0, 64, 64))
|
|
|
|
pic := pixel.PictureDataFromImage(img)
|
|
|
|
sprite := pixel.NewSprite(pic, pixel.R(0, 0, 64, 64))
|
|
|
|
batch := pixel.NewBatch(&pixel.TrianglesData{}, pic)
|
2017-07-02 12:04:20 -05:00
|
|
|
for i := 0; i < b.N; i++ {
|
|
|
|
sprite.Draw(batch, pixel.IM)
|
|
|
|
}
|
|
|
|
}
|