diff --git a/batch.go b/batch.go index bd60136849b75ef9a5b93da4a3128c46f4252b0b..0d6b00033239db76a6764b1546ed7e91a1fc89a6 100644 --- a/batch.go +++ b/batch.go @@ -52,9 +52,15 @@ func (b *Batch) MakeTriangles(t Triangles) Triangles { } } -// SetPicture does nothing, because the Picture of any Batch is fixed. +// SetPicture only checks, whether the supplied Picture has the same underlying Picture as the fixed +// Picture of this Batch. If that is not true, this method panics. func (b *Batch) SetPicture(p *Picture) { - // nothing, Batch has a fixed Picture + if p == nil { + return + } + if p.Texture() != b.pic.Texture() { + panic("batch: attempted to draw with a different Picture") + } } // SetTransform sets transforms used in the following draws onto the Batch.