graphics: Bounds doesn't work when the image is disposed

This commit is contained in:
Hajime Hoshi 2019-05-11 22:44:52 +09:00
parent 0bed5a96d5
commit cc8e8aef19

View File

@ -534,6 +534,9 @@ func (i *Image) SubImage(r image.Rectangle) image.Image {
// Bounds returns the bounds of the image. // Bounds returns the bounds of the image.
func (i *Image) Bounds() image.Rectangle { func (i *Image) Bounds() image.Rectangle {
if i.isDisposed() {
panic("ebiten: the image is already disposed")
}
if !i.isSubImage() { if !i.isSubImage() {
w, h := i.mipmap.original().Size() w, h := i.mipmap.original().Size()
return image.Rect(0, 0, w, h) return image.Rect(0, 0, w, h)