internal/atlas: add assertions

This commit is contained in:
Hajime Hoshi 2022-06-10 02:38:30 +09:00
parent 116e131ccf
commit bdae45be8f

View File

@ -335,7 +335,11 @@ func (i *Image) putOnAtlas(graphicsDriver graphicsdriver.Graphics) error {
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")
} }
newI := NewImage(i.width, i.height, i.imageType) if i.imageType != ImageTypeRegular {
panic(fmt.Sprintf("atlas: the image type must be ImageTypeRegular but %d", i.imageType))
}
newI := NewImage(i.width, i.height, ImageTypeRegular)
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