From 0c13fff62a6ac06f57bb368c4a02b24a78b1cf11 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 17 Jul 2020 02:16:32 +0900 Subject: [PATCH] ebiten: Add a restriction that all the source image sizes are same Updates #1193 --- image.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/image.go b/image.go index b9fb7244a..a7eef89bc 100644 --- a/image.go +++ b/image.go @@ -380,11 +380,17 @@ func (i *Image) DrawTrianglesWithShader(vertices []Vertex, indices []uint16, sha // The actual value is set at graphicscommand package. us := append([]interface{}{[]float32{0, 0}}, options.Uniforms...) + var imgw, imgh int var imgs []*buffered.Image for _, img := range options.Images { if img.isDisposed() { panic("ebiten: the given image to DrawTriangles must not be disposed") } + if imgw == 0 || imgh == 0 { + imgw, imgh = img.Size() + } else if w, h := img.Size(); imgw != w || imgh != h { + panic("ebiten: all the source images must be the same size") + } imgs = append(imgs, img.buffered) }