mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-23 00:10:11 +01:00
shareable: Refactoring
This commit is contained in:
parent
1c2c932c6c
commit
053f5a0ce7
@ -488,11 +488,12 @@ func (i *Image) allocate(shareable bool) {
|
|||||||
panic("shareable: the image is already allocated")
|
panic("shareable: the image is already allocated")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
runtime.SetFinalizer(i, (*Image).disposeFromFinalizer)
|
||||||
|
|
||||||
if i.screen {
|
if i.screen {
|
||||||
i.backend = &backend{
|
i.backend = &backend{
|
||||||
restorable: restorable.NewScreenFramebufferImage(i.width, i.height),
|
restorable: restorable.NewScreenFramebufferImage(i.width, i.height),
|
||||||
}
|
}
|
||||||
runtime.SetFinalizer(i, (*Image).disposeFromFinalizer)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +501,6 @@ func (i *Image) allocate(shareable bool) {
|
|||||||
i.backend = &backend{
|
i.backend = &backend{
|
||||||
restorable: restorable.NewImage(i.width, i.height, i.volatile),
|
restorable: restorable.NewImage(i.width, i.height, i.volatile),
|
||||||
}
|
}
|
||||||
runtime.SetFinalizer(i, (*Image).disposeFromFinalizer)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -508,7 +508,6 @@ func (i *Image) allocate(shareable bool) {
|
|||||||
if n, ok := b.TryAlloc(i.width, i.height); ok {
|
if n, ok := b.TryAlloc(i.width, i.height); ok {
|
||||||
i.backend = b
|
i.backend = b
|
||||||
i.node = n
|
i.node = n
|
||||||
runtime.SetFinalizer(i, (*Image).disposeFromFinalizer)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -532,7 +531,6 @@ func (i *Image) allocate(shareable bool) {
|
|||||||
}
|
}
|
||||||
i.backend = b
|
i.backend = b
|
||||||
i.node = n
|
i.node = n
|
||||||
runtime.SetFinalizer(i, (*Image).disposeFromFinalizer)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *Image) Dump(path string) error {
|
func (i *Image) Dump(path string) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user