mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 11:12:44 +01:00
parent
bcb30f8595
commit
79e067b0f8
@ -22,8 +22,10 @@ import (
|
|||||||
"image/draw"
|
"image/draw"
|
||||||
_ "image/png"
|
_ "image/png"
|
||||||
"math"
|
"math"
|
||||||
|
"math/rand"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
. "github.com/hajimehoshi/ebiten/v2"
|
. "github.com/hajimehoshi/ebiten/v2"
|
||||||
"github.com/hajimehoshi/ebiten/v2/examples/resources/images"
|
"github.com/hajimehoshi/ebiten/v2/examples/resources/images"
|
||||||
@ -31,6 +33,10 @@ import (
|
|||||||
t "github.com/hajimehoshi/ebiten/v2/internal/testing"
|
t "github.com/hajimehoshi/ebiten/v2/internal/testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
}
|
||||||
|
|
||||||
func skipTooSlowTests(t *testing.T) bool {
|
func skipTooSlowTests(t *testing.T) bool {
|
||||||
if testing.Short() {
|
if testing.Short() {
|
||||||
t.Skip("skipping test in short mode")
|
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