From 38d3811f1322adf07c495bd32561ca5ecfec996f Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 16 Jul 2020 00:51:38 +0900 Subject: [PATCH] Revert "mipmap: Bug fix: Wrong maximum size of the negative-level mipmap image" This reverts commit 48b192dbe9f4e9ee5466850451b4f814a8d71d9c. --- internal/mipmap/mipmap.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/mipmap/mipmap.go b/internal/mipmap/mipmap.go index c0a6d08d1..5079f4c6a 100644 --- a/internal/mipmap/mipmap.go +++ b/internal/mipmap/mipmap.go @@ -108,7 +108,7 @@ func (m *Mipmap) DrawImage(src *Mipmap, bounds image.Rectangle, geom GeoM, color return } - level := src.mipmapLevel(geom, filter) + level := src.mipmapLevel(geom, bounds.Dx(), bounds.Dy(), filter) if level > 0 { // 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 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() if math.IsNaN(float64(det)) { 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 - w, h := m.width, m.height + w, h := width, height if w >= mipmapMaxSize || h >= mipmapMaxSize { return 0 }