Added MinBy, MaxBy, MinByOrDefault and MaxByOrDefault methods and replaced calls of the style OrderBy[Descending]().First[OrDefault]() which is not as performant.

This commit is contained in:
RoosterDragon
2014-05-22 01:30:48 +01:00
parent db08357e36
commit 0ea3509ee4
16 changed files with 90 additions and 47 deletions

View File

@@ -222,8 +222,7 @@ namespace OpenRA.Utility
if (!remap.ContainsKey(i))
remap[i] = fullIndexRange
.Where(a => !remap.ContainsValue(a))
.OrderBy(a => ColorDistance(destPalette.Values[a], srcPalette.Values[i]))
.First();
.MinBy(a => ColorDistance(destPalette.Values[a], srcPalette.Values[i]));
var srcImage = ShpReader.Load(args[3]);