mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
parent
bcb30f8595
commit
79e067b0f8
@ -22,8 +22,10 @@ import (
|
||||
"image/draw"
|
||||
_ "image/png"
|
||||
"math"
|
||||
"math/rand"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/hajimehoshi/ebiten/v2"
|
||||
"github.com/hajimehoshi/ebiten/v2/examples/resources/images"
|
||||
@ -31,6 +33,10 @@ import (
|
||||
t "github.com/hajimehoshi/ebiten/v2/internal/testing"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
}
|
||||
|
||||
func skipTooSlowTests(t *testing.T) bool {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping test in short mode")
|
||||
@ -2405,3 +2411,15 @@ func TestImageEvenOdd(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// #1658
|
||||
func BenchmarkColorMScale(b *testing.B) {
|
||||
r := rand.Float64
|
||||
dst := NewImage(16, 16)
|
||||
src := NewImage(16, 16)
|
||||
for n := 0; n < b.N; n++ {
|
||||
op := &DrawImageOptions{}
|
||||
op.ColorM.Scale(r(), r(), r(), r())
|
||||
dst.DrawImage(src, op)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user