From ddfff68c20c32bcd61fc540656850fdd6541000a Mon Sep 17 00:00:00 2001 From: Homer Horwitz Date: Thu, 9 Oct 2008 18:46:09 +0000 Subject: [PATCH] Clean up webmap-generation a bit: - Remove some duplicated code - Avoid unnecessary allocation of variables/values if only used once anyway. --- .../Modules/World/WorldMap/WorldMapModule.cs | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs index 9b4a997978..ca64379334 100644 --- a/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/Environment/Modules/World/WorldMap/WorldMapModule.cs @@ -719,25 +719,11 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap // Save to bitmap mapTexture = new Bitmap(image); - ImageCodecInfo myImageCodecInfo; - - Encoder myEncoder; - - EncoderParameter myEncoderParameter; EncoderParameters myEncoderParameters = new EncoderParameters(); + myEncoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 95L); - myImageCodecInfo = GetEncoderInfo("image/jpeg"); - - myEncoder = Encoder.Quality; - - myEncoderParameter = new EncoderParameter(myEncoder, 95L); - myEncoderParameters.Param[0] = myEncoderParameter; - - myEncoderParameter = new EncoderParameter(myEncoder, 95L); - myEncoderParameters.Param[0] = myEncoderParameter; - - // Save bitmap to stream - mapTexture.Save(imgstream, myImageCodecInfo, myEncoderParameters); + // Save bitmap to stream + mapTexture.Save(imgstream, GetEncoderInfo("image/jpeg"), myEncoderParameters); // Write the stream to a byte array for output jpeg = imgstream.ToArray();