mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 04:22:05 +01:00
internal/atlas: refactoring
This commit is contained in:
parent
9ff93e3063
commit
5b8fd9733c
@ -747,20 +747,6 @@ func (i *Image) allocate(forbiddenBackends []*backend, asSource bool) {
|
|||||||
|
|
||||||
runtime.SetFinalizer(i, (*Image).finalize)
|
runtime.SetFinalizer(i, (*Image).finalize)
|
||||||
|
|
||||||
if i.imageType == ImageTypeScreen {
|
|
||||||
if asSource {
|
|
||||||
panic("atlas: a screen image cannot be created as a source")
|
|
||||||
}
|
|
||||||
// A screen image doesn't have a padding.
|
|
||||||
i.backend = &backend{
|
|
||||||
image: newClearedImage(i.width, i.height, true),
|
|
||||||
width: i.width,
|
|
||||||
height: i.height,
|
|
||||||
}
|
|
||||||
theBackends = append(theBackends, i.backend)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
wp := i.width + i.paddingSize()
|
wp := i.width + i.paddingSize()
|
||||||
hp := i.height + i.paddingSize()
|
hp := i.height + i.paddingSize()
|
||||||
|
|
||||||
@ -770,7 +756,7 @@ func (i *Image) allocate(forbiddenBackends []*backend, asSource bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i.backend = &backend{
|
i.backend = &backend{
|
||||||
image: newClearedImage(wp, hp, false),
|
image: newClearedImage(wp, hp, i.imageType == ImageTypeScreen),
|
||||||
width: wp,
|
width: wp,
|
||||||
height: hp,
|
height: hp,
|
||||||
source: asSource && i.imageType == ImageTypeRegular,
|
source: asSource && i.imageType == ImageTypeRegular,
|
||||||
|
Loading…
Reference in New Issue
Block a user