Revert "mipmap: Bug fix: Wrong maximum size of the negative-level mipmap image"

This reverts commit 48b192dbe9.
This commit is contained in:
Hajime Hoshi 2020-07-16 00:51:38 +09:00
parent a4e669cc39
commit 38d3811f13

View File

@ -108,7 +108,7 @@ func (m *Mipmap) DrawImage(src *Mipmap, bounds image.Rectangle, geom GeoM, color
return return
} }
level := src.mipmapLevel(geom, filter) level := src.mipmapLevel(geom, bounds.Dx(), bounds.Dy(), filter)
if level > 0 { if level > 0 {
// If the image can be scaled into 0 size, adjust the level. (#839) // If the image can be scaled into 0 size, adjust the level. (#839)
@ -312,7 +312,7 @@ func (m *Mipmap) disposeMipmaps() {
// mipmapLevel returns an appropriate mipmap level for the given determinant of a geometry matrix. // mipmapLevel returns an appropriate mipmap level for the given determinant of a geometry matrix.
// //
// mipmapLevel panics if det is NaN or 0. // mipmapLevel panics if det is NaN or 0.
func (m *Mipmap) mipmapLevel(geom GeoM, filter driver.Filter) int { func (m *Mipmap) mipmapLevel(geom GeoM, width, height int, filter driver.Filter) int {
det := geom.det() det := geom.det()
if math.IsNaN(float64(det)) { if math.IsNaN(float64(det)) {
panic("ebiten: det must be finite at mipmapLevel") panic("ebiten: det must be finite at mipmapLevel")
@ -338,7 +338,7 @@ func (m *Mipmap) mipmapLevel(geom GeoM, filter driver.Filter) int {
} }
const mipmapMaxSize = 1024 const mipmapMaxSize = 1024
w, h := m.width, m.height w, h := width, height
if w >= mipmapMaxSize || h >= mipmapMaxSize { if w >= mipmapMaxSize || h >= mipmapMaxSize {
return 0 return 0
} }