From 83da4ea11231f38e456441f774ea744b530a1396 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 13 Feb 2019 01:58:08 +0900 Subject: [PATCH] graphics: Forbid mipmap for a volatile image explicitly --- image.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/image.go b/image.go index 6825c2cae..2bfe2a21d 100644 --- a/image.go +++ b/image.go @@ -61,17 +61,16 @@ func (m *mipmap) level(r image.Rectangle, level int) *shareable.Image { } for len(imgs) < idx+1 { + if m.orig.IsVolatile() { + panic("ebiten: mipmap images for a volatile image is not implemented yet") + } + w2 := w / 2 h2 := h / 2 if w2 == 0 || h2 == 0 { return nil } s := shareable.NewImage(w2, h2) - if m.orig.IsVolatile() { - // TODO: As s is cleared every frame, is there any reason to keep it? - s.MakeVolatile() - } - var src *shareable.Image var vs []float32 if l := len(imgs); l == 0 { @@ -315,7 +314,7 @@ func (i *Image) drawImage(img *Image, options *DrawImageOptions) { a, b, c, d, tx, ty := geom.elements() level := 0 - if filter == graphics.FilterLinear { + if filter == graphics.FilterLinear && !img.mipmap.original().IsVolatile() { det := geom.det() if det == 0 { return