mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 12:08:58 +01:00
graphics: Bug fix: unexpected panic at Set with an out-of-range position
This commit is contained in:
parent
cbe4844fa0
commit
1b011e3864
2
image.go
2
image.go
@ -408,7 +408,7 @@ func (img *Image) Set(x, y int, clr color.Color) {
|
|||||||
if img.isDisposed() {
|
if img.isDisposed() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if img.isSubImage() && !image.Pt(x, y).In(img.bounds) {
|
if !image.Pt(x, y).In(img.Bounds()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if img.isSubImage() {
|
if img.isSubImage() {
|
||||||
|
@ -1439,6 +1439,7 @@ func TestImageSet(t *testing.T) {
|
|||||||
{1, 2}: {3, 4, 5, 6},
|
{1, 2}: {3, 4, 5, 6},
|
||||||
{7, 8}: {9, 10, 11, 12},
|
{7, 8}: {9, 10, 11, 12},
|
||||||
{13, 14}: {15, 16, 17, 18},
|
{13, 14}: {15, 16, 17, 18},
|
||||||
|
{-1, -1}: {19, 20, 21, 22},
|
||||||
}
|
}
|
||||||
|
|
||||||
for p, c := range colors {
|
for p, c := range colors {
|
||||||
|
Loading…
Reference in New Issue
Block a user