|
@ -652,6 +652,8 @@ public class Game : GameWindow { |
|
|
|
|
|
|
|
|
allPhotos.Sort(ComparePhotosByDate); |
|
|
allPhotos.Sort(ComparePhotosByDate); |
|
|
photos = allPhotos; |
|
|
photos = allPhotos; |
|
|
|
|
|
|
|
|
|
|
|
LoadThumbnailsAsync(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static int ComparePhotosByDate(Photo x, Photo y) { |
|
|
private static int ComparePhotosByDate(Photo x, Photo y) { |
|
@ -669,11 +671,9 @@ public class Game : GameWindow { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void UnloadImages() { |
|
|
private void UnloadImages() { |
|
|
return; |
|
|
|
|
|
// Unload images that haven't been touched in a while.
|
|
|
// Unload images that haven't been touched in a while.
|
|
|
// FIXME: keep around thumbnail-sized textures?
|
|
|
|
|
|
lock (loadedImagesLock) { |
|
|
lock (loadedImagesLock) { |
|
|
while (loadedImages.Count > 100) { |
|
|
|
|
|
|
|
|
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) { |
|
@ -704,9 +704,8 @@ 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 - 30); |
|
|
|
|
|
// int maxLoadedImage = Math.Min(photoIndex + 30, photos.Count - 1);
|
|
|
|
|
|
int maxLoadedImage = photos.Count - 1; |
|
|
|
|
|
|
|
|
int minLoadedImage = Math.Max(0, photoIndex - 10); |
|
|
|
|
|
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++) { |
|
|
lock (loadedImagesLock) { |
|
|
lock (loadedImagesLock) { |
|
@ -722,6 +721,12 @@ public class Game : GameWindow { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private async void LoadThumbnailsAsync() { |
|
|
|
|
|
foreach (Photo p in allPhotos) { |
|
|
|
|
|
await Task.Run( () => { p.LoadThumbnailAsync(); }); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// To find the JPEG compression level of a file from the command line:
|
|
|
// To find the JPEG compression level of a file from the command line:
|
|
|
// $ identify -verbose image.jpg | grep Quality:
|
|
|
// $ identify -verbose image.jpg | grep Quality:
|
|
|
// FIXME: don't ExportPhotos() if another export is already active.
|
|
|
// FIXME: don't ExportPhotos() if another export is already active.
|
|
@ -988,9 +993,9 @@ static class Program { |
|
|
nwSettings.CurrentMonitor = bestMonitor.Handle; |
|
|
nwSettings.CurrentMonitor = bestMonitor.Handle; |
|
|
nwSettings.Location = new Vector2i(bestMonitor.WorkArea.Min.X + 1, |
|
|
nwSettings.Location = new Vector2i(bestMonitor.WorkArea.Min.X + 1, |
|
|
bestMonitor.WorkArea.Min.Y + 31); |
|
|
bestMonitor.WorkArea.Min.Y + 31); |
|
|
// nwSettings.Size = new Vector2i(bestMonitor.WorkArea.Size.X - 2,
|
|
|
|
|
|
// bestMonitor.WorkArea.Size.Y - 32);
|
|
|
|
|
|
nwSettings.Size = new Vector2i(1600, 900); |
|
|
|
|
|
|
|
|
nwSettings.Size = new Vector2i(bestMonitor.WorkArea.Size.X - 2, |
|
|
|
|
|
bestMonitor.WorkArea.Size.Y - 32); |
|
|
|
|
|
// nwSettings.Size = new Vector2i(1600, 900);
|
|
|
nwSettings.MinimumSize = UiGeometry.MIN_WINDOW_SIZE; |
|
|
nwSettings.MinimumSize = UiGeometry.MIN_WINDOW_SIZE; |
|
|
nwSettings.Title = "Totte"; |
|
|
nwSettings.Title = "Totte"; |
|
|
nwSettings.IsEventDriven = true; |
|
|
nwSettings.IsEventDriven = true; |
|
|