graphics: Add image state check at DrawTriangles

This commit is contained in:
Hajime Hoshi 2018-10-28 01:43:28 +09:00
parent 170f0fcaa9
commit 41877bba0b

View File

@ -451,8 +451,15 @@ type DrawTrianglesOptions struct {
// Note that Ebiten creates texture atlases internally, so you still have to care this even when // Note that Ebiten creates texture atlases internally, so you still have to care this even when
// you render a single image. // you render a single image.
// //
// When the image i is disposed, DrawTriangles does nothing.
//
// Note that this API is experimental. // Note that this API is experimental.
func (i *Image) DrawTriangles(vertices []Vertex, indices []uint16, img *Image, options *DrawTrianglesOptions) { func (i *Image) DrawTriangles(vertices []Vertex, indices []uint16, img *Image, options *DrawTrianglesOptions) {
i.copyCheck()
if i.isDisposed() {
return
}
if len(indices)%3 != 0 { if len(indices)%3 != 0 {
panic("ebiten: len(indices) % 3 must be 0") panic("ebiten: len(indices) % 3 must be 0")
} }