mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-10-04 23:53:10 +08:00
graphics: Bug fix: Flush after filling (#419)
This commit is contained in:
@@ -490,7 +490,7 @@ func TestImageFill(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Issue 317
|
||||
// Issue #317
|
||||
func TestImageEdge(t *testing.T) {
|
||||
const (
|
||||
img0Width = 16
|
||||
@@ -561,6 +561,28 @@ func TestImageEdge(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Issue #419
|
||||
func TestImageTooManyFill(t *testing.T) {
|
||||
const width = 256
|
||||
|
||||
src, _ := NewImage(1, 1, FilterNearest)
|
||||
dst, _ := NewImage(width, 1, FilterNearest)
|
||||
for i := 0; i < width; i++ {
|
||||
src.Fill(color.RGBA{uint8(i), uint8(i), uint8(i), 0xff})
|
||||
op := &DrawImageOptions{}
|
||||
op.GeoM.Translate(float64(i), 0)
|
||||
dst.DrawImage(src, op)
|
||||
}
|
||||
|
||||
for i := 0; i < width; i++ {
|
||||
got := color.RGBAModel.Convert(dst.At(i, 0))
|
||||
want := color.RGBA{uint8(i), uint8(i), uint8(i), 0xff}
|
||||
if got != want {
|
||||
t.Errorf("src At(%d, %d): got %#v, want: %#v", i, 0, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkDrawImage(b *testing.B) {
|
||||
img0, _ := NewImage(16, 16, FilterNearest)
|
||||
img1, _ := NewImage(16, 16, FilterNearest)
|
||||
|
Reference in New Issue
Block a user