aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-14 01:11:30 +0100
committerJustin Clark-Casey (justincc)2012-07-14 01:11:30 +0100
commitec6a195e40ad570a6e812c952f0505e76e7323d1 (patch)
tree036e13125cf283ed162c9f2fbe4de2fe6df4260d
parentRemove a callstack print out I accidentally left in 2 commits ago in 9ccb578 (diff)
downloadopensim-SC_OLD-ec6a195e40ad570a6e812c952f0505e76e7323d1.zip
opensim-SC_OLD-ec6a195e40ad570a6e812c952f0505e76e7323d1.tar.gz
opensim-SC_OLD-ec6a195e40ad570a6e812c952f0505e76e7323d1.tar.bz2
opensim-SC_OLD-ec6a195e40ad570a6e812c952f0505e76e7323d1.tar.xz
When generating a Warp3D texture, set the detailTexture[i] variable on resize from the JPEG2000 original rather than only saving it to disk.
This appears to be the cause of the warp 3d exception seen when starting a new region for the first time. Subsequent starts were okay because resized saved bitmap was correctly retrieved from disk. Should fix http://opensimulator.org/mantis/view.php?id=5204 and http://opensimulator.org/mantis/view.php?id=5272
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs21
1 files changed, 14 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
index 91252f7..df5ac92 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/TerrainSplat.cs
@@ -111,6 +111,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
111 asset = assetService.GetCached(cacheID.ToString()); 111 asset = assetService.GetCached(cacheID.ToString());
112 if (asset != null) 112 if (asset != null)
113 { 113 {
114// m_log.DebugFormat(
115// "[TERRAIN SPLAT]: Got asset service cached terrain texture {0} {1}", i, asset.ID);
116
114 try 117 try
115 { 118 {
116 using (System.IO.MemoryStream stream = new System.IO.MemoryStream(asset.Data)) 119 using (System.IO.MemoryStream stream = new System.IO.MemoryStream(asset.Data))
@@ -129,6 +132,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
129 asset = assetService.Get(textureIDs[i].ToString()); 132 asset = assetService.Get(textureIDs[i].ToString());
130 if (asset != null) 133 if (asset != null)
131 { 134 {
135// m_log.DebugFormat(
136// "[TERRAIN SPLAT]: Got cached original JPEG2000 terrain texture {0} {1}", i, asset.ID);
137
132 try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); } 138 try { detailTexture[i] = (Bitmap)CSJ2K.J2kImage.FromBytes(asset.Data); }
133 catch (Exception ex) 139 catch (Exception ex)
134 { 140 {
@@ -137,15 +143,13 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
137 } 143 }
138 144
139 if (detailTexture[i] != null) 145 if (detailTexture[i] != null)
140 { 146 {
141 Bitmap bitmap = detailTexture[i];
142
143 // Make sure this texture is the correct size, otherwise resize 147 // Make sure this texture is the correct size, otherwise resize
144 if (bitmap.Width != 256 || bitmap.Height != 256) 148 if (detailTexture[i].Width != 256 || detailTexture[i].Height != 256)
145 { 149 {
146 using (Bitmap origBitmap = bitmap) 150 using (Bitmap origBitmap = detailTexture[i])
147 { 151 {
148 bitmap = ImageUtils.ResizeImage(origBitmap, 256, 256); 152 detailTexture[i] = ImageUtils.ResizeImage(origBitmap, 256, 256);
149 } 153 }
150 } 154 }
151 155
@@ -153,7 +157,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
153 byte[] data; 157 byte[] data;
154 using (System.IO.MemoryStream stream = new System.IO.MemoryStream()) 158 using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
155 { 159 {
156 bitmap.Save(stream, ImageFormat.Png); 160 detailTexture[i].Save(stream, ImageFormat.Png);
157 data = stream.ToArray(); 161 data = stream.ToArray();
158 } 162 }
159 163
@@ -185,6 +189,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
185 { 189 {
186 if (detailTexture[i] == null) 190 if (detailTexture[i] == null)
187 { 191 {
192// m_log.DebugFormat(
193// "[TERRAIN SPLAT]: Generating solid colour for missing texture {0}", i);
194
188 // Create a solid color texture for this layer 195 // Create a solid color texture for this layer
189 detailTexture[i] = new Bitmap(256, 256, PixelFormat.Format24bppRgb); 196 detailTexture[i] = new Bitmap(256, 256, PixelFormat.Format24bppRgb);
190 using (Graphics gfx = Graphics.FromImage(detailTexture[i])) 197 using (Graphics gfx = Graphics.FromImage(detailTexture[i]))