mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
graphics: Fix TestImage4096
This commit is contained in:
parent
fe140c2caf
commit
2014822f12
@ -685,19 +685,34 @@ func TestImage4096(t *testing.T) {
|
|||||||
src, _ := NewImage(4096, 4096, FilterNearest)
|
src, _ := NewImage(4096, 4096, FilterNearest)
|
||||||
dst, _ := NewImage(4096, 4096, FilterNearest)
|
dst, _ := NewImage(4096, 4096, FilterNearest)
|
||||||
pix := make([]byte, 4096*4096*4)
|
pix := make([]byte, 4096*4096*4)
|
||||||
for j := 4095; j < 4096; j++ {
|
for i := 0; i < 4096; i++ {
|
||||||
for i := 4095; i < 4096; i++ {
|
j := 4095
|
||||||
idx := 4 * (i + j*4096)
|
idx := 4 * (i + j*4096)
|
||||||
pix[idx] = uint8(i + j)
|
pix[idx] = uint8(i + j)
|
||||||
pix[idx+1] = uint8((i + j) >> 8)
|
pix[idx+1] = uint8((i + j) >> 8)
|
||||||
pix[idx+2] = uint8((i + j) >> 16)
|
pix[idx+2] = uint8((i + j) >> 16)
|
||||||
pix[idx+3] = 0xff
|
pix[idx+3] = 0xff
|
||||||
}
|
}
|
||||||
|
for j := 0; j < 4096; j++ {
|
||||||
|
i := 4095
|
||||||
|
idx := 4 * (i + j*4096)
|
||||||
|
pix[idx] = uint8(i + j)
|
||||||
|
pix[idx+1] = uint8((i + j) >> 8)
|
||||||
|
pix[idx+2] = uint8((i + j) >> 16)
|
||||||
|
pix[idx+3] = 0xff
|
||||||
}
|
}
|
||||||
src.ReplacePixels(pix)
|
src.ReplacePixels(pix)
|
||||||
dst.DrawImage(src, nil)
|
dst.DrawImage(src, nil)
|
||||||
for j := 4095; j < 4096; j++ {
|
|
||||||
for i := 4095; i < 4096; i++ {
|
for i := 4095; i < 4096; i++ {
|
||||||
|
j := 4095
|
||||||
|
got := color.RGBAModel.Convert(dst.At(i, j)).(color.RGBA)
|
||||||
|
want := color.RGBA{uint8(i + j), uint8((i + j) >> 8), uint8((i + j) >> 16), 0xff}
|
||||||
|
if got != want {
|
||||||
|
t.Errorf("At(%d, %d): got: %#v, want: %#v", i, j, got, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for j := 4095; j < 4096; j++ {
|
||||||
|
i := 4095
|
||||||
got := color.RGBAModel.Convert(dst.At(i, j)).(color.RGBA)
|
got := color.RGBAModel.Convert(dst.At(i, j)).(color.RGBA)
|
||||||
want := color.RGBA{uint8(i + j), uint8((i + j) >> 8), uint8((i + j) >> 16), 0xff}
|
want := color.RGBA{uint8(i + j), uint8((i + j) >> 8), uint8((i + j) >> 16), 0xff}
|
||||||
if got != want {
|
if got != want {
|
||||||
@ -705,4 +720,3 @@ func TestImage4096(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user