From 41877bba0ba49299adf3e9142ba6650ca69aa8d5 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 28 Oct 2018 01:43:28 +0900 Subject: [PATCH] graphics: Add image state check at DrawTriangles --- image.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/image.go b/image.go index d65ee2a7b..963c7dc57 100644 --- a/image.go +++ b/image.go @@ -451,8 +451,15 @@ type DrawTrianglesOptions struct { // Note that Ebiten creates texture atlases internally, so you still have to care this even when // you render a single image. // +// When the image i is disposed, DrawTriangles does nothing. +// // Note that this API is experimental. func (i *Image) DrawTriangles(vertices []Vertex, indices []uint16, img *Image, options *DrawTrianglesOptions) { + i.copyCheck() + if i.isDisposed() { + return + } + if len(indices)%3 != 0 { panic("ebiten: len(indices) % 3 must be 0") }