mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-09 20:47:26 +01:00
parent
d98df45a39
commit
bbbc41a04d
@ -61,4 +61,4 @@ func (i *Image) EnsureIsolatedForTesting() {
|
||||
|
||||
var FlushDeferredForTesting = flushDeferred
|
||||
|
||||
var ToPowerOf2 = toPowerOf2
|
||||
var FloorPowerOf2 = floorPowerOf2
|
||||
|
@ -728,7 +728,7 @@ func EndFrame(graphicsDriver graphicsdriver.Graphics) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func toPowerOf2(x int) int {
|
||||
func floorPowerOf2(x int) int {
|
||||
if x <= 0 {
|
||||
return 0
|
||||
}
|
||||
@ -757,7 +757,7 @@ func BeginFrame(graphicsDriver graphicsdriver.Graphics) error {
|
||||
minSize = 1024
|
||||
}
|
||||
if maxSize == 0 {
|
||||
maxSize = toPowerOf2(restorable.MaxImageSize(graphicsDriver))
|
||||
maxSize = floorPowerOf2(restorable.MaxImageSize(graphicsDriver))
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -776,10 +776,10 @@ func TestPowerOf2(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
got := atlas.ToPowerOf2(tc.In)
|
||||
got := atlas.FloorPowerOf2(tc.In)
|
||||
want := tc.Out
|
||||
if got != want {
|
||||
t.Errorf("packing.ToPowerOf2(%d): got: %d, want: %d", tc.In, got, want)
|
||||
t.Errorf("packing.FloorPowerOf2(%d): got: %d, want: %d", tc.In, got, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user