Compare commits
2 Commits
87e029e7f8
...
775252b567
Author | SHA1 | Date | |
---|---|---|---|
775252b567 | |||
7bd3719c72 |
11
Program.cs
11
Program.cs
@ -846,7 +846,7 @@ public class Game : GameWindow {
|
||||
// string[] files = Directory.GetFiles(@"c:\users\colin\pictures\photos\2023\09\06\jpg");
|
||||
// string[] files = Directory.GetFiles(@"G:\DCIM\100EOSR6\");
|
||||
// string[] files = Directory.GetFiles(@"c:\users\colin\desktop\totte-output\2023\08\03");
|
||||
string[] files = Directory.GetFiles(@"c:\users\colin\desktop\import");
|
||||
string[] files = Directory.GetFiles(@"c:\users\colin\desktop\17\2-jpg");
|
||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Pictures\photos\2018\06\23");
|
||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\Germany all\104D7000");
|
||||
// string[] files = Directory.GetFiles(@"C:\Users\colin\Desktop\many-birds\");
|
||||
@ -897,7 +897,7 @@ public class Game : GameWindow {
|
||||
private void UnloadImages() {
|
||||
// Unload images that haven't been touched in a while.
|
||||
lock (loadedImagesLock) {
|
||||
while (loadedImages.Count > 30) {
|
||||
while (loadedImages.Count > 20) {
|
||||
long earliestTime = long.MaxValue;
|
||||
Photo? earliest = null;
|
||||
foreach (Photo photo in loadedImages) {
|
||||
@ -926,7 +926,7 @@ public class Game : GameWindow {
|
||||
}
|
||||
}
|
||||
// Start loading any images that are in our window but not yet loaded.
|
||||
int minLoadedImage = Math.Max(0, photoIndex - 10);
|
||||
int minLoadedImage = Math.Max(0, photoIndex - 5);
|
||||
int maxLoadedImage = Math.Min(photoIndex + 10, photos.Count - 1);
|
||||
List<Photo> toLoad = new();
|
||||
for (int i = minLoadedImage; i <= maxLoadedImage; i++) {
|
||||
@ -939,7 +939,8 @@ public class Game : GameWindow {
|
||||
}
|
||||
}
|
||||
foreach (Photo p in toLoad) {
|
||||
await Task.Run( () => { p.LoadAsync(p.Size); });
|
||||
// await Task.Run( () => { p.LoadAsync(p.Size); });
|
||||
await Task.Run( () => { p.LoadAsync(geometry.PhotoBox.Size); });
|
||||
}
|
||||
}
|
||||
|
||||
@ -947,7 +948,7 @@ public class Game : GameWindow {
|
||||
List<Task> tasks = new();
|
||||
foreach (Photo p in allPhotos) {
|
||||
tasks.Add(Task.Run( () => {
|
||||
p.LoadThumbnailAsync(new Vector2i(256, 256));
|
||||
p.LoadThumbnailAsync(new Vector2i(150, 150));
|
||||
lock (numThumbnailsLoadedLock) {
|
||||
numThumbnailsLoaded++;
|
||||
toast.Set($"[{numThumbnailsLoaded}/{allPhotos.Count}] Loading thumbnails");
|
||||
|
Loading…
Reference in New Issue
Block a user