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