From fe02e13a119065532be6669b6334ba31b35359fe Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Fri, 28 Jul 2023 14:36:02 -0400 Subject: [PATCH] keep around more loaded images --- Program.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Program.cs b/Program.cs index 1ed7801..e0ee263 100644 --- a/Program.cs +++ b/Program.cs @@ -438,9 +438,11 @@ public class UiGeometry { public UiGeometry(Vector2i windowSize, int starSize) { WindowSize = windowSize; - int numThumbnails = 15; + int numThumbnails = WindowSize.Y / 100; int thumbnailHeight = WindowSize.Y / numThumbnails; int thumbnailWidth = (int) 1.0 * thumbnailHeight * activeCamera.Resolution.X / activeCamera.Resolution.Y; + + Console.WriteLine($"thumbnail size: {thumbnailWidth} x {thumbnailHeight}"); for (int i = 0; i < numThumbnails; i++) { Box2i box = Util.MakeBox(WindowSize.X - thumbnailWidth, i * thumbnailHeight, thumbnailWidth, thumbnailHeight); ThumbnailBoxes.Add(box); @@ -815,7 +817,7 @@ public class Game : GameWindow { // Unload images that haven't been touched in a while. // FIXME: keep around thumbnail-sized textures? lock (loadedImagesLock) { - while (loadedImages.Count > 60) { + while (loadedImages.Count > 100) { long earliestTime = long.MaxValue; Photo? earliest = null; foreach (Photo photo in loadedImages) { @@ -825,7 +827,7 @@ public class Game : GameWindow { } } if (earliest != null) { - // Console.WriteLine($"loadedImages.Count: {loadedImages.Count}, evicting {earliest.Filename} @ {earliestTime}"); + Console.WriteLine($"loadedImages.Count: {loadedImages.Count}, evicting {earliest.Filename} @ {earliestTime}"); // TODO: we have to free textures on the GL thread, but could we do that async'ly to keep the UI responsive? earliest.Unload(); loadedImages.Remove(earliest);