Convert custom map previews that are not using PixelFormat.Format32bppArgb.
This commit is contained in:
@@ -12,6 +12,7 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
@@ -391,8 +392,16 @@ namespace OpenRA
|
|||||||
DefaultSubCell = (SubCell)Game.ModData.Manifest.SubCellDefaultIndex;
|
DefaultSubCell = (SubCell)Game.ModData.Manifest.SubCellDefaultIndex;
|
||||||
|
|
||||||
if (Container.Exists("map.png"))
|
if (Container.Exists("map.png"))
|
||||||
|
{
|
||||||
using (var dataStream = Container.GetContent("map.png"))
|
using (var dataStream = Container.GetContent("map.png"))
|
||||||
CustomPreview = new Bitmap(dataStream);
|
CustomPreview = new Bitmap(dataStream);
|
||||||
|
if (CustomPreview.PixelFormat != PixelFormat.Format32bppArgb)
|
||||||
|
{
|
||||||
|
var original = CustomPreview;
|
||||||
|
CustomPreview = original.Clone(original.Bounds(), PixelFormat.Format32bppArgb);
|
||||||
|
original.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PostInit();
|
PostInit();
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
@@ -155,6 +156,12 @@ namespace OpenRA
|
|||||||
SpawnPoints = spawns;
|
SpawnPoints = spawns;
|
||||||
|
|
||||||
CustomPreview = new Bitmap(new MemoryStream(Convert.FromBase64String(r.minimap)));
|
CustomPreview = new Bitmap(new MemoryStream(Convert.FromBase64String(r.minimap)));
|
||||||
|
if (CustomPreview.PixelFormat != PixelFormat.Format32bppArgb)
|
||||||
|
{
|
||||||
|
var original = CustomPreview;
|
||||||
|
CustomPreview = original.Clone(original.Bounds(), PixelFormat.Format32bppArgb);
|
||||||
|
original.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user