mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Revert "internal/restorable: remove ImageTypeRestorable"
This reverts commit 8c2d4e1408
.
Updates #3083
This commit is contained in:
parent
169b9fe51e
commit
34639d0028
@ -677,9 +677,13 @@ func (i *Image) allocate(forbiddenBackends []*backend, asSource bool) {
|
|||||||
panic(fmt.Sprintf("atlas: the image being put on an atlas is too big: width: %d, height: %d", i.width, i.height))
|
panic(fmt.Sprintf("atlas: the image being put on an atlas is too big: width: %d, height: %d", i.width, i.height))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typ := restorable.ImageTypeRegular
|
||||||
|
if i.imageType == ImageTypeVolatile {
|
||||||
|
typ = restorable.ImageTypeVolatile
|
||||||
|
}
|
||||||
i.backend = &backend{
|
i.backend = &backend{
|
||||||
restorable: restorable.NewImage(wp, hp, restorable.ImageTypeRegular),
|
restorable: restorable.NewImage(wp, hp, typ),
|
||||||
source: asSource && i.imageType == ImageTypeRegular,
|
source: asSource && typ == restorable.ImageTypeRegular,
|
||||||
}
|
}
|
||||||
theBackends = append(theBackends, i.backend)
|
theBackends = append(theBackends, i.backend)
|
||||||
return
|
return
|
||||||
@ -723,8 +727,12 @@ loop:
|
|||||||
height *= 2
|
height *= 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typ := restorable.ImageTypeRegular
|
||||||
|
if i.imageType == ImageTypeVolatile {
|
||||||
|
typ = restorable.ImageTypeVolatile
|
||||||
|
}
|
||||||
b := &backend{
|
b := &backend{
|
||||||
restorable: restorable.NewImage(width, height, restorable.ImageTypeRegular),
|
restorable: restorable.NewImage(width, height, typ),
|
||||||
page: packing.NewPage(width, height, maxSize),
|
page: packing.NewPage(width, height, maxSize),
|
||||||
source: asSource,
|
source: asSource,
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,9 @@ const (
|
|||||||
|
|
||||||
// ImageTypeScreen indicates the image is used as an actual screen.
|
// ImageTypeScreen indicates the image is used as an actual screen.
|
||||||
ImageTypeScreen
|
ImageTypeScreen
|
||||||
|
|
||||||
|
// ImageTypeVolatile indicates the image is cleared whenever a frame starts.
|
||||||
|
ImageTypeVolatile
|
||||||
)
|
)
|
||||||
|
|
||||||
// Image represents an image.
|
// Image represents an image.
|
||||||
|
Loading…
Reference in New Issue
Block a user