From 63cda3a6d0910b74680cd343ab7bc07a6651f1cb Mon Sep 17 00:00:00 2001 From: Garmin Kawaguichi Date: Thu, 19 Apr 2012 15:47:56 +0200 Subject: concerns GenericSystemDrawing.cs in OpenSim\Region\CoreModules\World\Terrain\FileLoaders\GenericSystemDrawing.cs Ln 67 Apply Justin's solution Signed-off-by: Garmin Kawaguichi --- .../World/Terrain/FileLoaders/GenericSystemDrawing.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index da81dc1..cd46276 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs @@ -64,18 +64,19 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) { - Bitmap bitmap = new Bitmap(filename); - ITerrainChannel retval = new TerrainChannel(true); - - for (int x = 0; x < retval.Width; x++) + using (Bitmap bitmap = new Bitmap(filename)) { - for (int y = 0; y < retval.Height; y++) + ITerrainChannel retval = new TerrainChannel(true); + + for (int x = 0; x < retval.Width; x++) { - retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; + for (int y = 0; y < retval.Height; y++) + { + retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; + } } + return retval; } - - return retval; } public virtual ITerrainChannel LoadStream(Stream stream) -- cgit v1.1