shareable: Improve panic messages

This commit is contained in:
Hajime Hoshi 2019-02-09 19:47:45 +09:00
parent a5421de8ab
commit 815f2a6b35

View File

@ -220,10 +220,10 @@ func (i *Image) DrawImage(img *Image, vertices []float32, indices []uint16, colo
defer backendsM.Unlock() defer backendsM.Unlock()
if img.disposed { if img.disposed {
panic("shareable: the drawing source image must not be disposed") panic("shareable: the drawing source image must not be disposed (DrawImage)")
} }
if i.disposed { if i.disposed {
panic("shareable: the drawing target image must not be disposed") panic("shareable: the drawing target image must not be disposed (DrawImage)")
} }
if img.backend == nil { if img.backend == nil {
img.allocate(true) img.allocate(true)
@ -262,7 +262,7 @@ var emptyImage = NewImage(16, 16)
func (i *Image) Fill(r, g, b, a uint8) { func (i *Image) Fill(r, g, b, a uint8) {
backendsM.Lock() backendsM.Lock()
if i.disposed { if i.disposed {
panic("shareable: the drawing target image must not be disposed") panic("shareable: the drawing target image must not be disposed (Fill)")
} }
i.ensureNotShared() i.ensureNotShared()
backendsM.Unlock() backendsM.Unlock()
@ -293,7 +293,7 @@ func (i *Image) ReplacePixels(p []byte) {
func (i *Image) replacePixels(p []byte) { func (i *Image) replacePixels(p []byte) {
if i.disposed { if i.disposed {
panic("shareable: the image must not be disposed") panic("shareable: the image must not be disposed at replacePixels")
} }
if i.backend == nil { if i.backend == nil {
if p == nil { if p == nil {