mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-21 11:20:58 +00:00
Reduce memory usage during preview image loading
This commit is contained in:
parent
65fdafafd8
commit
c95e5af46d
1 changed files with 9 additions and 1 deletions
|
@ -228,9 +228,17 @@ namespace CodeImp.DoomBuilder.Data
|
||||||
ConvertImageFormat(loadResult);
|
ConvertImageFormat(loadResult);
|
||||||
MakeImagePreview(loadResult);
|
MakeImagePreview(loadResult);
|
||||||
|
|
||||||
|
// Save memory by disposing the original image immediately if we only used it to load a preview image
|
||||||
|
bool onlyPreview = false;
|
||||||
|
if (imagestate == ImageLoadState.Ready)
|
||||||
|
{
|
||||||
|
loadResult.bitmap?.Dispose();
|
||||||
|
onlyPreview = true;
|
||||||
|
}
|
||||||
|
|
||||||
General.MainWindow.RunOnUIThread(() =>
|
General.MainWindow.RunOnUIThread(() =>
|
||||||
{
|
{
|
||||||
if (imagestate != ImageLoadState.Ready)
|
if (imagestate != ImageLoadState.Ready && !onlyPreview)
|
||||||
{
|
{
|
||||||
// Log errors and warnings
|
// Log errors and warnings
|
||||||
foreach (LogMessage message in loadResult.messages)
|
foreach (LogMessage message in loadResult.messages)
|
||||||
|
|
Loading…
Reference in a new issue