mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +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
b7c07a3355
commit
31c8bd8367
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 {
|
||||
if level == 0 {
|
||||
panic("ebiten: level must not be 0 (original image) at level")
|
||||
if level <= 0 {
|
||||
panic("ebiten: level must be positive at level")
|
||||
}
|
||||
|
||||
imgs, ok := m.imgs[r]
|
||||
@ -336,6 +336,11 @@ func (i *Image) drawImage(img *Image, options *DrawImageOptions) {
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
if level < 0 {
|
||||
// As the render source is too small, nothing is rendered.
|
||||
return
|
||||
}
|
||||
}
|
||||
if level > 6 {
|
||||
level = 6
|
||||
|
Loading…
Reference in New Issue
Block a user