diff options
author | Justin Clark-Casey (justincc) | 2014-01-24 19:16:59 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-01-24 19:16:59 +0000 |
commit | 87e725cd2474efcdfec3d85794ef2b877c8b78d6 (patch) | |
tree | ffd2f4e5fffecb84e76f07d3fd87d9f29b5fcada /OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | |
parent | Change version to 0.7.6.1-rc1 instead (diff) | |
parent | Properly dispose of drawing objects to reduce/stop memory leakage on generati... (diff) | |
download | opensim-SC_OLD-87e725cd2474efcdfec3d85794ef2b877c8b78d6.zip opensim-SC_OLD-87e725cd2474efcdfec3d85794ef2b877c8b78d6.tar.gz opensim-SC_OLD-87e725cd2474efcdfec3d85794ef2b877c8b78d6.tar.bz2 opensim-SC_OLD-87e725cd2474efcdfec3d85794ef2b877c8b78d6.tar.xz |
Merge branch '0.7.6-extended' into 0.7.6-post-fixes
Diffstat (limited to 'OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs index d13c2ef..e895178 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs | |||
@@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
173 | private Bitmap fetchTexture(UUID id) | 173 | private Bitmap fetchTexture(UUID id) |
174 | { | 174 | { |
175 | AssetBase asset = m_scene.AssetService.Get(id.ToString()); | 175 | AssetBase asset = m_scene.AssetService.Get(id.ToString()); |
176 | m_log.DebugFormat("[TexturedMapTileRenderer]: Fetched texture {0}, found: {1}", id, asset != null); | 176 | m_log.DebugFormat("[TEXTURED MAP TILE RENDERER]: Fetched texture {0}, found: {1}", id, asset != null); |
177 | if (asset == null) return null; | 177 | if (asset == null) return null; |
178 | 178 | ||
179 | ManagedImage managedImage; | 179 | ManagedImage managedImage; |
@@ -188,17 +188,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
188 | } | 188 | } |
189 | catch (DllNotFoundException) | 189 | catch (DllNotFoundException) |
190 | { | 190 | { |
191 | m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", id); | 191 | m_log.ErrorFormat("[TEXTURED MAP TILE RENDERER]: OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", id); |
192 | 192 | ||
193 | } | 193 | } |
194 | catch (IndexOutOfRangeException) | 194 | catch (IndexOutOfRangeException) |
195 | { | 195 | { |
196 | m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id); | 196 | m_log.ErrorFormat("[TEXTURED MAP TILE RENDERER]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id); |
197 | 197 | ||
198 | } | 198 | } |
199 | catch (Exception) | 199 | catch (Exception) |
200 | { | 200 | { |
201 | m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id); | 201 | m_log.ErrorFormat("[TEXTURED MAP TILE RENDERER]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id); |
202 | 202 | ||
203 | } | 203 | } |
204 | return null; | 204 | return null; |
@@ -233,10 +233,14 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
233 | if (textureID == UUID.Zero) return defaultColor; // not set | 233 | if (textureID == UUID.Zero) return defaultColor; // not set |
234 | if (m_mapping.ContainsKey(textureID)) return m_mapping[textureID]; // one of the predefined textures | 234 | if (m_mapping.ContainsKey(textureID)) return m_mapping[textureID]; // one of the predefined textures |
235 | 235 | ||
236 | Bitmap bmp = fetchTexture(textureID); | 236 | Color color; |
237 | Color color = bmp == null ? defaultColor : computeAverageColor(bmp); | 237 | |
238 | // store it for future reference | 238 | using (Bitmap bmp = fetchTexture(textureID)) |
239 | m_mapping[textureID] = color; | 239 | { |
240 | color = bmp == null ? defaultColor : computeAverageColor(bmp); | ||
241 | // store it for future reference | ||
242 | m_mapping[textureID] = color; | ||
243 | } | ||
240 | 244 | ||
241 | return color; | 245 | return color; |
242 | } | 246 | } |
@@ -278,7 +282,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
278 | public void TerrainToBitmap(Bitmap mapbmp) | 282 | public void TerrainToBitmap(Bitmap mapbmp) |
279 | { | 283 | { |
280 | int tc = Environment.TickCount; | 284 | int tc = Environment.TickCount; |
281 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Terrain"); | 285 | m_log.Debug("[TEXTURED MAP TILE RENDERER]: Generating Maptile Step 1: Terrain"); |
282 | 286 | ||
283 | // These textures should be in the AssetCache anyway, as every client conneting to this | 287 | // These textures should be in the AssetCache anyway, as every client conneting to this |
284 | // region needs them. Except on start, when the map is recreated (before anyone connected), | 288 | // region needs them. Except on start, when the map is recreated (before anyone connected), |
@@ -412,7 +416,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
412 | } | 416 | } |
413 | } | 417 | } |
414 | } | 418 | } |
415 | m_log.Debug("[MAPTILE]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); | 419 | |
420 | m_log.Debug("[TEXTURED MAP TILE RENDERER]: Generating Maptile Step 1: Done in " + (Environment.TickCount - tc) + " ms"); | ||
416 | } | 421 | } |
417 | } | 422 | } |
418 | } | 423 | } \ No newline at end of file |