From bbbc41a04d6176ea035b9113ce2923dd6cfd3751 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 2 Jan 2023 20:17:44 +0900 Subject: [PATCH] internal/atlas: rename functions Updates #2519 --- internal/atlas/export_test.go | 2 +- internal/atlas/image.go | 4 ++-- internal/atlas/image_test.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) 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) } } }