mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-24 18:02:02 +01:00
graphics: Bug fix: level must be >= 0
There was a cache that level can be negative. This change fixes this.
This commit is contained in:
parent
cce41e8152
commit
6022d8856e
9
image.go
9
image.go
@ -42,8 +42,8 @@ func (m *mipmap) original() *shareable.Image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *mipmap) level(r image.Rectangle, level int) *shareable.Image {
|
func (m *mipmap) level(r image.Rectangle, level int) *shareable.Image {
|
||||||
if level == 0 {
|
if level <= 0 {
|
||||||
panic("ebiten: level must not be 0 (original image) at level")
|
panic("ebiten: level must be positive at level")
|
||||||
}
|
}
|
||||||
|
|
||||||
imgs, ok := m.imgs[r]
|
imgs, ok := m.imgs[r]
|
||||||
@ -336,6 +336,11 @@ func (i *Image) drawImage(img *Image, options *DrawImageOptions) {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if level < 0 {
|
||||||
|
// As the render source is too small, nothing is rendered.
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if level > 6 {
|
if level > 6 {
|
||||||
level = 6
|
level = 6
|
||||||
|
Loading…
Reference in New Issue
Block a user