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
This commit is contained in:
Hajime Hoshi 2021-01-31 22:35:37 +09:00
parent 82050d6ac1
commit 345c25f204

View File

@ -40,6 +40,7 @@ type Image struct {
bounds image.Rectangle bounds image.Rectangle
original *Image original *Image
screen bool
} }
func (i *Image) copyCheck() { func (i *Image) copyCheck() {
@ -183,7 +184,7 @@ func (i *Image) DrawImage(img *Image, options *DrawImageOptions) {
sy0 := float32(bounds.Min.Y) sy0 := float32(bounds.Min.Y)
sx1 := float32(bounds.Max.X) sx1 := float32(bounds.Max.X)
sy1 := float32(bounds.Max.Y) 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() is := graphics.QuadIndices()
srcs := [graphics.ShaderImageNum]*mipmap.Mipmap{img.mipmap} srcs := [graphics.ShaderImageNum]*mipmap.Mipmap{img.mipmap}
@ -748,5 +749,6 @@ func newScreenFramebufferImage(width, height int) *Image {
bounds: image.Rect(0, 0, width, height), bounds: image.Rect(0, 0, width, height),
} }
i.addr = i i.addr = i
i.screen = true
return i return i
} }