mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
internal/atlas: add special backends to theBackends for consistency
This commit is contained in:
parent
fe0b33db58
commit
fdf36026ae
@ -94,6 +94,9 @@ type backend struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *backend) tryAlloc(width, height int) (*packing.Node, bool) {
|
func (b *backend) tryAlloc(width, height int) (*packing.Node, bool) {
|
||||||
|
if b.page == nil {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
n := b.page.Alloc(width, height)
|
n := b.page.Alloc(width, height)
|
||||||
if n == nil {
|
if n == nil {
|
||||||
// The page can't be extended anymore. Return as failure.
|
// The page can't be extended anymore. Return as failure.
|
||||||
@ -643,6 +646,7 @@ func (i *Image) allocate(forbiddenBackends []*backend, asSource bool) {
|
|||||||
i.backend = &backend{
|
i.backend = &backend{
|
||||||
restorable: restorable.NewImage(i.width, i.height, restorable.ImageTypeScreen),
|
restorable: restorable.NewImage(i.width, i.height, restorable.ImageTypeScreen),
|
||||||
}
|
}
|
||||||
|
theBackends = append(theBackends, i.backend)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,6 +662,7 @@ func (i *Image) allocate(forbiddenBackends []*backend, asSource bool) {
|
|||||||
restorable: restorable.NewImage(wp, hp, restorable.ImageTypeRegular),
|
restorable: restorable.NewImage(wp, hp, restorable.ImageTypeRegular),
|
||||||
source: asSource && i.imageType == ImageTypeRegular,
|
source: asSource && i.imageType == ImageTypeRegular,
|
||||||
}
|
}
|
||||||
|
theBackends = append(theBackends, i.backend)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user