mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
parent
bb1021a549
commit
4d270de75e
@ -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