mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-28 19:52:43 +01:00
graphics: Forbid mipmap for a volatile image explicitly
This commit is contained in:
parent
6930176fbb
commit
83da4ea112
11
image.go
11
image.go
@ -61,17 +61,16 @@ func (m *mipmap) level(r image.Rectangle, level int) *shareable.Image {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for len(imgs) < idx+1 {
|
for len(imgs) < idx+1 {
|
||||||
|
if m.orig.IsVolatile() {
|
||||||
|
panic("ebiten: mipmap images for a volatile image is not implemented yet")
|
||||||
|
}
|
||||||
|
|
||||||
w2 := w / 2
|
w2 := w / 2
|
||||||
h2 := h / 2
|
h2 := h / 2
|
||||||
if w2 == 0 || h2 == 0 {
|
if w2 == 0 || h2 == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
s := shareable.NewImage(w2, h2)
|
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 src *shareable.Image
|
||||||
var vs []float32
|
var vs []float32
|
||||||
if l := len(imgs); l == 0 {
|
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()
|
a, b, c, d, tx, ty := geom.elements()
|
||||||
|
|
||||||
level := 0
|
level := 0
|
||||||
if filter == graphics.FilterLinear {
|
if filter == graphics.FilterLinear && !img.mipmap.original().IsVolatile() {
|
||||||
det := geom.det()
|
det := geom.det()
|
||||||
if det == 0 {
|
if det == 0 {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user