mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-22 16:00:09 +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")
|
||||
}
|
||||
|
||||
runtime.SetFinalizer(i, (*Image).disposeFromFinalizer)
|
||||
|
||||
if i.screen {
|
||||
i.backend = &backend{
|
||||
restorable: restorable.NewScreenFramebufferImage(i.width, i.height),
|
||||
}
|
||||
runtime.SetFinalizer(i, (*Image).disposeFromFinalizer)
|
||||
return
|
||||
}
|
||||
|
||||
@ -500,7 +501,6 @@ func (i *Image) allocate(shareable bool) {
|
||||
i.backend = &backend{
|
||||
restorable: restorable.NewImage(i.width, i.height, i.volatile),
|
||||
}
|
||||
runtime.SetFinalizer(i, (*Image).disposeFromFinalizer)
|
||||
return
|
||||
}
|
||||
|
||||
@ -508,7 +508,6 @@ func (i *Image) allocate(shareable bool) {
|
||||
if n, ok := b.TryAlloc(i.width, i.height); ok {
|
||||
i.backend = b
|
||||
i.node = n
|
||||
runtime.SetFinalizer(i, (*Image).disposeFromFinalizer)
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -532,7 +531,6 @@ func (i *Image) allocate(shareable bool) {
|
||||
}
|
||||
i.backend = b
|
||||
i.node = n
|
||||
runtime.SetFinalizer(i, (*Image).disposeFromFinalizer)
|
||||
}
|
||||
|
||||
func (i *Image) Dump(path string) error {
|
||||
|
Loading…
Reference in New Issue
Block a user