internal/atlas: rename functions

Updates #2519
This commit is contained in:
Hajime Hoshi 2023-01-02 20:17:44 +09:00
parent d98df45a39
commit bbbc41a04d
3 changed files with 5 additions and 5 deletions

View File

@ -61,4 +61,4 @@ func (i *Image) EnsureIsolatedForTesting() {
var FlushDeferredForTesting = flushDeferred
var ToPowerOf2 = toPowerOf2
var FloorPowerOf2 = floorPowerOf2

View File

@ -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 {

View File

@ -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)
}
}
}