shareable: Bug fix: volatile or screen must not use shareable texture

This commit is contained in:
Hajime Hoshi 2018-07-24 22:25:15 +09:00
parent d10d319d7e
commit 5beaf843a6

View File

@ -93,6 +93,8 @@ type Image struct {
node *packing.Node node *packing.Node
countForShare int countForShare int
neverShared bool
} }
func (i *Image) moveTo(dst *Image) { func (i *Image) moveTo(dst *Image) {
@ -337,6 +339,9 @@ func NewImage(width, height int) *Image {
} }
func (i *Image) shareable() bool { func (i *Image) shareable() bool {
if i.neverShared {
return false
}
return i.width <= maxSize && i.height <= maxSize return i.width <= maxSize && i.height <= maxSize
} }
@ -396,6 +401,7 @@ func NewVolatileImage(width, height int) *Image {
backend: &backend{ backend: &backend{
restorable: r, restorable: r,
}, },
neverShared: true,
} }
runtime.SetFinalizer(i, (*Image).Dispose) runtime.SetFinalizer(i, (*Image).Dispose)
return i return i
@ -412,6 +418,7 @@ func NewScreenFramebufferImage(width, height int) *Image {
backend: &backend{ backend: &backend{
restorable: r, restorable: r,
}, },
neverShared: true,
} }
runtime.SetFinalizer(i, (*Image).Dispose) runtime.SetFinalizer(i, (*Image).Dispose)
return i return i