mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
restorable: Use nil instead of empty affine.ColorM
This commit is contained in:
parent
ccd9241b07
commit
2f1908b05c
@ -127,7 +127,7 @@ func (i *Image) makeStale() {
|
||||
|
||||
var (
|
||||
dummyImage = graphics.NewImage(16, 16)
|
||||
clearColorM = &affine.ColorM{}
|
||||
clearColorM *affine.ColorM
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -132,7 +132,7 @@ func TestRestoreChain(t *testing.T) {
|
||||
clr := color.RGBA{0x00, 0x00, 0x00, 0xff}
|
||||
fill(imgs[0], clr.R, clr.G, clr.B, clr.A)
|
||||
for i := 0; i < num-1; i++ {
|
||||
imgs[i+1].DrawImage(imgs[i], 0, 0, 1, 1, nil, &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
imgs[i+1].DrawImage(imgs[i], 0, 0, 1, 1, nil, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
}
|
||||
if err := ResolveStaleImages(); err != nil {
|
||||
t.Fatal(err)
|
||||
@ -167,10 +167,10 @@ func TestRestoreOverrideSource(t *testing.T) {
|
||||
clr0 := color.RGBA{0x00, 0x00, 0x00, 0xff}
|
||||
clr1 := color.RGBA{0x00, 0x00, 0x01, 0xff}
|
||||
fill(img1, clr0.R, clr0.G, clr0.B, clr0.A)
|
||||
img2.DrawImage(img1, 0, 0, 1, 1, nil, &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img3.DrawImage(img2, 0, 0, 1, 1, nil, &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img2.DrawImage(img1, 0, 0, 1, 1, nil, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img3.DrawImage(img2, 0, 0, 1, 1, nil, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
fill(img0, clr1.R, clr1.G, clr1.B, clr1.A)
|
||||
img1.DrawImage(img0, 0, 0, 1, 1, nil, &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img1.DrawImage(img0, 0, 0, 1, 1, nil, nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
if err := ResolveStaleImages(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -248,15 +248,15 @@ func TestRestoreComplexGraph(t *testing.T) {
|
||||
img1.Dispose()
|
||||
img0.Dispose()
|
||||
}()
|
||||
img3.DrawImage(img0, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(0, 0), &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img3.DrawImage(img1, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(1, 0), &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img4.DrawImage(img1, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(1, 0), &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img4.DrawImage(img2, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(2, 0), &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img5.DrawImage(img3, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(0, 0), &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img6.DrawImage(img3, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(0, 0), &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img6.DrawImage(img4, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(1, 0), &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img7.DrawImage(img2, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(0, 0), &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img7.DrawImage(img3, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(2, 0), &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img3.DrawImage(img0, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(0, 0), nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img3.DrawImage(img1, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(1, 0), nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img4.DrawImage(img1, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(1, 0), nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img4.DrawImage(img2, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(2, 0), nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img5.DrawImage(img3, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(0, 0), nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img6.DrawImage(img3, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(0, 0), nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img6.DrawImage(img4, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(1, 0), nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img7.DrawImage(img2, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(0, 0), nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img7.DrawImage(img3, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(2, 0), nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
if err := ResolveStaleImages(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -343,8 +343,8 @@ func TestRestoreRecursive(t *testing.T) {
|
||||
img1.Dispose()
|
||||
img0.Dispose()
|
||||
}()
|
||||
img1.DrawImage(img0, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(1, 0), &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img0.DrawImage(img1, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(1, 0), &affine.ColorM{}, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img1.DrawImage(img0, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(1, 0), nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
img0.DrawImage(img1, 0, 0, 4, 1, (*affine.GeoM)(nil).Translate(1, 0), nil, opengl.CompositeModeSourceOver, graphics.FilterNearest)
|
||||
if err := ResolveStaleImages(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user