From 0af5b41d4842fed5756cdda5911639ae7c530633 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 29 Apr 2024 23:34:37 +0900 Subject: [PATCH] internal/atlas: refactoring --- internal/atlas/export_test.go | 8 ++------ internal/atlas/image.go | 15 ++++----------- internal/atlas/image_test.go | 30 +++++++++++++++--------------- 3 files changed, 21 insertions(+), 32 deletions(-) diff --git a/internal/atlas/export_test.go b/internal/atlas/export_test.go index dc0a00bf5411..eb8af636c8fe 100644 --- a/internal/atlas/export_test.go +++ b/internal/atlas/export_test.go @@ -14,16 +14,12 @@ package atlas -import ( - "github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver" -) - const ( BaseCountToPutOnSourceBackend = baseCountToPutOnSourceBackend ) -func PutImagesOnSourceBackendForTesting(graphicsDriver graphicsdriver.Graphics) { - putImagesOnSourceBackend(graphicsDriver) +func PutImagesOnSourceBackendForTesting() { + putImagesOnSourceBackend() } var ( diff --git a/internal/atlas/image.go b/internal/atlas/image.go index 9a07d015e074..defce3335ced 100644 --- a/internal/atlas/image.go +++ b/internal/atlas/image.go @@ -36,13 +36,6 @@ var ( maxSize = 0 ) -func max(a, b int) int { - if a > b { - return a - } - return b -} - func min(a, b int) int { if a < b { return a @@ -81,7 +74,7 @@ func flushDeferred() { // Actual time duration is increased in an exponential way for each usage as a rendering target. const baseCountToPutOnSourceBackend = 10 -func putImagesOnSourceBackend(graphicsDriver graphicsdriver.Graphics) { +func putImagesOnSourceBackend() { // The counter usedAsDestinationCount is updated at most once per frame (#2676). imagesUsedAsDestination.forEach(func(i *Image) { // This counter is not updated when the backend is created in this frame. @@ -97,7 +90,7 @@ func putImagesOnSourceBackend(graphicsDriver graphicsdriver.Graphics) { i.usedAsSourceCount++ } if int64(i.usedAsSourceCount) >= int64(baseCountToPutOnSourceBackend*(1<