diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index b71b5f6..b96d95a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs | |||
@@ -70,10 +70,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
70 | 70 | ||
71 | #region IMapImageGenerator Members | 71 | #region IMapImageGenerator Members |
72 | 72 | ||
73 | public byte[] WriteJpeg2000Image(string gradientmap) | 73 | public Bitmap CreateMapTile(string gradientmap) |
74 | { | 74 | { |
75 | byte[] imageData = null; | ||
76 | |||
77 | bool drawPrimVolume = true; | 75 | bool drawPrimVolume = true; |
78 | bool textureTerrain = false; | 76 | bool textureTerrain = false; |
79 | 77 | ||
@@ -98,32 +96,36 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
98 | } | 96 | } |
99 | terrainRenderer.Initialise(m_scene, m_config); | 97 | terrainRenderer.Initialise(m_scene, m_config); |
100 | 98 | ||
101 | using (Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize)) | 99 | Bitmap mapbmp = new Bitmap((int)Constants.RegionSize, (int)Constants.RegionSize, System.Drawing.Imaging.PixelFormat.Format24bppRgb); |
102 | { | 100 | //long t = System.Environment.TickCount; |
103 | //long t = System.Environment.TickCount; | 101 | //for (int i = 0; i < 10; ++i) { |
104 | //for (int i = 0; i < 10; ++i) { | 102 | terrainRenderer.TerrainToBitmap(mapbmp); |
105 | terrainRenderer.TerrainToBitmap(mapbmp); | 103 | //} |
106 | //} | 104 | //t = System.Environment.TickCount - t; |
107 | //t = System.Environment.TickCount - t; | 105 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); |
108 | //m_log.InfoFormat("[MAPTILE] generation of 10 maptiles needed {0} ms", t); | ||
109 | 106 | ||
110 | 107 | ||
111 | if (drawPrimVolume) | 108 | if (drawPrimVolume) |
112 | { | 109 | { |
113 | DrawObjectVolume(m_scene, mapbmp); | 110 | DrawObjectVolume(m_scene, mapbmp); |
114 | } | 111 | } |
115 | 112 | ||
116 | try | 113 | return mapbmp; |
117 | { | 114 | } |
118 | imageData = OpenJPEG.EncodeFromImage(mapbmp, true); | 115 | |
119 | } | 116 | public byte[] WriteJpeg2000Image(string gradientmap) |
120 | catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke | 117 | { |
121 | { | 118 | try |
122 | m_log.Error("Failed generating terrain map: " + e); | 119 | { |
123 | } | 120 | using (Bitmap mapbmp = CreateMapTile(gradientmap)) |
121 | return OpenJPEG.EncodeFromImage(mapbmp, true); | ||
122 | } | ||
123 | catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke | ||
124 | { | ||
125 | m_log.Error("Failed generating terrain map: " + e); | ||
124 | } | 126 | } |
125 | 127 | ||
126 | return imageData; | 128 | return null; |
127 | } | 129 | } |
128 | 130 | ||
129 | #endregion | 131 | #endregion |