diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | 17 |
1 files 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 | |||
64 | 64 | ||
65 | public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) | 65 | public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) |
66 | { | 66 | { |
67 | Bitmap bitmap = new Bitmap(filename); | 67 | using (Bitmap bitmap = new Bitmap(filename)) |
68 | ITerrainChannel retval = new TerrainChannel(true); | ||
69 | |||
70 | for (int x = 0; x < retval.Width; x++) | ||
71 | { | 68 | { |
72 | for (int y = 0; y < retval.Height; y++) | 69 | ITerrainChannel retval = new TerrainChannel(true); |
70 | |||
71 | for (int x = 0; x < retval.Width; x++) | ||
73 | { | 72 | { |
74 | retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; | 73 | for (int y = 0; y < retval.Height; y++) |
74 | { | ||
75 | retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; | ||
76 | } | ||
75 | } | 77 | } |
78 | return retval; | ||
76 | } | 79 | } |
77 | |||
78 | return retval; | ||
79 | } | 80 | } |
80 | 81 | ||
81 | public virtual ITerrainChannel LoadStream(Stream stream) | 82 | public virtual ITerrainChannel LoadStream(Stream stream) |