Clean up webmap-generation a bit:

- Remove some duplicated code
- Avoid unnecessary allocation of variables/values if only used once anyway.
0.6.0-stable
Homer Horwitz 2008-10-09 18:46:09 +00:00
parent c692c14a2f
commit ddfff68c20
1 changed files with 3 additions and 17 deletions

View File

@ -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();