From 321bc6d998e6478c6e05d1d0a6333d47f704d6d4 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 31 Jan 2021 22:35:37 +0900 Subject: [PATCH] ebiten: Bug fix: The vertex backend was not flushed when the screen is shrunk The last parameter of QuadVertices represents whether we can flush the backend vertices (on Wasm). The problem was that this was unexpectedly false even though the image is the screen, when the screen rendering is done with FilterLinear instead of FilterScreen. Closes #1479 --- image.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/image.go b/image.go index c69b2d415..460ce1c3f 100644 --- a/image.go +++ b/image.go @@ -44,6 +44,8 @@ type Image struct { original *Image filter Filter + + screen bool } func (i *Image) copyCheck() { @@ -254,7 +256,7 @@ func (i *Image) DrawImage(img *Image, options *DrawImageOptions) error { sy0 := float32(bounds.Min.Y) sx1 := float32(bounds.Max.X) sy1 := float32(bounds.Max.Y) - vs := graphics.QuadVertices(sx0, sy0, sx1, sy1, a, b, c, d, tx, ty, 1, 1, 1, 1, filter == driver.FilterScreen) + vs := graphics.QuadVertices(sx0, sy0, sx1, sy1, a, b, c, d, tx, ty, 1, 1, 1, 1, i.screen) is := graphics.QuadIndices() srcs := [graphics.ShaderImageNum]*mipmap.Mipmap{img.mipmap} @@ -849,6 +851,7 @@ func newScreenFramebufferImage(width, height int) *Image { bounds: image.Rect(0, 0, width, height), } i.addr = i + i.screen = true return i }