internal/atlas: add an assertion at putOnAtlas

This commit is contained in:
Hajime Hoshi 2022-06-06 09:01:04 +09:00
parent 9bf5f2188f
commit 7f10744514

View File

@ -323,9 +323,11 @@ func (i *Image) putOnAtlas(graphicsDriver graphicsdriver.Graphics) error {
if !i.canBePutOnAtlas() { if !i.canBePutOnAtlas() {
panic("atlas: putOnAtlas cannot be called on a image that cannot be on an atlas") panic("atlas: putOnAtlas cannot be called on a image that cannot be on an atlas")
} }
if i.volatile {
panic("atlas: a volatile image cannot be put on an atlas")
}
newI := NewImage(i.width, i.height) newI := NewImage(i.width, i.height)
newI.SetVolatile(i.volatile)
if restorable.NeedsRestoring() { if restorable.NeedsRestoring() {
// If the underlying graphics driver requires restoring from the context lost, the pixel data is // If the underlying graphics driver requires restoring from the context lost, the pixel data is