diff --git a/internal/atlas/export_test.go b/internal/atlas/export_test.go index b20e2e1f2..dc7529963 100644 --- a/internal/atlas/export_test.go +++ b/internal/atlas/export_test.go @@ -61,4 +61,4 @@ func (i *Image) EnsureIsolatedForTesting() { var FlushDeferredForTesting = flushDeferred -var ToPowerOf2 = toPowerOf2 +var FloorPowerOf2 = floorPowerOf2 diff --git a/internal/atlas/image.go b/internal/atlas/image.go index 66aebb43d..3f6c07a5c 100644 --- a/internal/atlas/image.go +++ b/internal/atlas/image.go @@ -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 { diff --git a/internal/atlas/image_test.go b/internal/atlas/image_test.go index 5aa0b5c1d..b5e6ca3e1 100644 --- a/internal/atlas/image_test.go +++ b/internal/atlas/image_test.go @@ -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) } } }