diff --git a/OpenRA.Editor/Form1.cs b/OpenRA.Editor/Form1.cs index ccce078bbd..66298daf21 100644 --- a/OpenRA.Editor/Form1.cs +++ b/OpenRA.Editor/Form1.cs @@ -198,10 +198,12 @@ namespace OpenRA.Editor surface1.BindResourceTemplates(resourceTemplates); - foreach (var p in palettes) { p.Visible = true; p.ResumeLayout(); - var terrainBitmap = Minimap.TerrainBitmap(surface1.Map); - pmMiniMap.Image = terrainBitmap; + foreach (var p in palettes) + { + p.Visible = true; + p.ResumeLayout(); } + pmMiniMap.Image = Minimap.TerrainBitmap(surface1.Map, true); } @@ -340,10 +342,8 @@ namespace OpenRA.Editor surface1.Map.Save(loadedMapName); using (var nms = new MapSelect()) { - var terrainBitmap = Minimap.TerrainBitmap(surface1.Map); - nms.pbMinimap.Image = terrainBitmap; - Bitmap png = new Bitmap(nms.pbMinimap.Image); - png.Save(Path.Combine(loadedMapName, "map.png"), System.Drawing.Imaging.ImageFormat.Png); + Minimap.TerrainBitmap(surface1.Map, true) + .Save(Path.Combine(loadedMapName, "map.png"), System.Drawing.Imaging.ImageFormat.Png); } dirty = false; } @@ -535,12 +535,9 @@ namespace OpenRA.Editor pb.Show(); } - private void surface1_Click_1(object sender, EventArgs e) { - var terrainBitmap = Minimap.TerrainBitmap(surface1.Map); - pmMiniMap.Image = terrainBitmap; + pmMiniMap.Image = Minimap.TerrainBitmap(surface1.Map, true); } - } } \ No newline at end of file diff --git a/OpenRA.Editor/MapSelect.Designer.cs b/OpenRA.Editor/MapSelect.Designer.cs index c7a9156a38..8251c33964 100644 --- a/OpenRA.Editor/MapSelect.Designer.cs +++ b/OpenRA.Editor/MapSelect.Designer.cs @@ -3,14 +3,14 @@ partial class MapSelect { /// - /// Требуется переменная конструктора. + /// TODO /// private System.ComponentModel.IContainer components = null; /// - /// Освободить все используемые ресурсы. + /// TODO /// - /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + /// TODO protected override void Dispose(bool disposing) { if (disposing && (components != null)) @@ -23,8 +23,7 @@ #region Код, автоматически созданный конструктором форм Windows /// - /// Обязательный метод для поддержки конструктора - не изменяйте - /// содержимое данного метода при помощи редактора кода. + /// TODO /// private void InitializeComponent() { @@ -136,7 +135,7 @@ this.pbMinimap.Location = new System.Drawing.Point(32, 25); this.pbMinimap.Name = "pbMinimap"; this.pbMinimap.Size = new System.Drawing.Size(124, 124); - this.pbMinimap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pbMinimap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pbMinimap.TabIndex = 5; this.pbMinimap.TabStop = false; // diff --git a/OpenRA.Game/Graphics/Minimap.cs b/OpenRA.Game/Graphics/Minimap.cs index dcae699f03..975c057aa9 100644 --- a/OpenRA.Game/Graphics/Minimap.cs +++ b/OpenRA.Game/Graphics/Minimap.cs @@ -21,10 +21,22 @@ namespace OpenRA.Graphics public class Minimap { public static Bitmap TerrainBitmap(Map map) + { + return TerrainBitmap(map, false); + } + + public static Bitmap TerrainBitmap(Map map, bool actualSize) { var tileset = Rules.TileSets[map.Tileset]; - var size = Util.NextPowerOf2(Math.Max(map.Width, map.Height)); - Bitmap terrain = new Bitmap(size, size); + var width = map.Width; + var height = map.Height; + + if (!actualSize) + { + width = height = Util.NextPowerOf2(Math.Max(map.Width, map.Height)); + } + + Bitmap terrain = new Bitmap(width, height); var bitmapData = terrain.LockBits(new Rectangle(0, 0, terrain.Width, terrain.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);