add Picture correctness check in Batch.SetPicture
This commit is contained in:
parent
b610760f1c
commit
268e1b72f5
10
batch.go
10
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.
|
||||
|
|
Loading…
Reference in New Issue