From bdae45be8f13dc6a341cb630b1362b7ae1e0129b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 10 Jun 2022 02:38:30 +0900 Subject: [PATCH] internal/atlas: add assertions --- internal/atlas/image.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/atlas/image.go b/internal/atlas/image.go index 98da1d966..51206d71a 100644 --- a/internal/atlas/image.go +++ b/internal/atlas/image.go @@ -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") } - 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 the underlying graphics driver requires restoring from the context lost, the pixel data is