mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/atlas: improve deallocation
This commit is contained in:
parent
8c2d4e1408
commit
fe0b33db58
@ -592,12 +592,14 @@ func (i *Image) deallocate() {
|
|||||||
|
|
||||||
for idx, sh := range theBackends {
|
for idx, sh := range theBackends {
|
||||||
if sh == i.backend {
|
if sh == i.backend {
|
||||||
theBackends = append(theBackends[:idx], theBackends[idx+1:]...)
|
copy(theBackends[idx:], theBackends[idx+1:])
|
||||||
|
theBackends[len(theBackends)-1] = nil
|
||||||
|
theBackends = theBackends[:len(theBackends)-1]
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
panic("atlas: backend not found at an image being disposed")
|
panic("atlas: backend not found at an image being deallocated")
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewImage(width, height int, imageType ImageType) *Image {
|
func NewImage(width, height int, imageType ImageType) *Image {
|
||||||
|
Loading…
Reference in New Issue
Block a user