From 2c34619aea074446e53dde80d397973075914bac Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 23 Oct 2009 14:22:21 -0700 Subject: * Changed various modules to not initialize timers unless the module is initialized. Ideally, the timers would not initialize unless the module was actually enabled, but Melanie's work on configuring module loading from a config file should make that unnecessary * Wrapped the Bitmap class used to generate the world map tile in a using statement to dispose of it after the JPEG2000 data is created --- .../CoreModules/World/WorldMap/MapImageModule.cs | 36 ++++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/CoreModules') diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 5fd8369..285d36a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs @@ -98,27 +98,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap } terrainRenderer.Initialise(m_scene, m_config); - Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize); - //long t = System.Environment.TickCount; - //for (int i = 0; i < 10; ++i) { + using (Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize)) + { + //long t = System.Environment.TickCount; + //for (int i = 0; i < 10; ++i) { terrainRenderer.TerrainToBitmap(mapbmp); - //} - //t = System.Environment.TickCount - t; - //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); + //} + //t = System.Environment.TickCount - t; + //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); - if (drawPrimVolume) - { - DrawObjectVolume(m_scene, mapbmp); - } + if (drawPrimVolume) + { + DrawObjectVolume(m_scene, mapbmp); + } - try - { - imageData = OpenJPEG.EncodeFromImage(mapbmp, true); - } - catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke - { - m_log.Error("Failed generating terrain map: " + e); + try + { + imageData = OpenJPEG.EncodeFromImage(mapbmp, true); + } + catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke + { + m_log.Error("Failed generating terrain map: " + e); + } } return imageData; -- cgit v1.1