diff options
author | dahlia | 2010-11-02 02:35:56 -0700 |
---|---|---|
committer | dahlia | 2010-11-02 02:35:56 -0700 |
commit | ed7959ddfbff413c18d1167eccda0d3436a26b8c (patch) | |
tree | 84b35b62e84b028d9aabc95f0b61d69097ac59e2 /OpenSim/Region/CoreModules/Scripting | |
parent | Fix HypergridLinker.Check4096() (diff) | |
download | opensim-SC_OLD-ed7959ddfbff413c18d1167eccda0d3436a26b8c.zip opensim-SC_OLD-ed7959ddfbff413c18d1167eccda0d3436a26b8c.tar.gz opensim-SC_OLD-ed7959ddfbff413c18d1167eccda0d3436a26b8c.tar.bz2 opensim-SC_OLD-ed7959ddfbff413c18d1167eccda0d3436a26b8c.tar.xz |
Thanks Snoopy for a patch that addresses Mantis #0005165: osSetDynamicTextureURL crashed region server
Signed-off-by: dahlia <dahliaTrimble@gmail.removeme.com>
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index c23cea5..ed3e516 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs | |||
@@ -176,44 +176,44 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL | |||
176 | stream = response.GetResponseStream(); | 176 | stream = response.GetResponseStream(); |
177 | if (stream != null) | 177 | if (stream != null) |
178 | { | 178 | { |
179 | Bitmap image = new Bitmap(stream); | ||
180 | Size newsize; | ||
181 | |||
182 | // TODO: make this a bit less hard coded | ||
183 | if ((image.Height < 64) && (image.Width < 64)) | ||
184 | { | ||
185 | newsize = new Size(32, 32); | ||
186 | } | ||
187 | else if ((image.Height < 128) && (image.Width < 128)) | ||
188 | { | ||
189 | newsize = new Size(64, 64); | ||
190 | } | ||
191 | else if ((image.Height < 256) && (image.Width < 256)) | ||
192 | { | ||
193 | newsize = new Size(128, 128); | ||
194 | } | ||
195 | else if ((image.Height < 512 && image.Width < 512)) | ||
196 | { | ||
197 | newsize = new Size(256, 256); | ||
198 | } | ||
199 | else if ((image.Height < 1024 && image.Width < 1024)) | ||
200 | { | ||
201 | newsize = new Size(512, 512); | ||
202 | } | ||
203 | else | ||
204 | { | ||
205 | newsize = new Size(1024, 1024); | ||
206 | } | ||
207 | |||
208 | Bitmap resize = new Bitmap(image, newsize); | ||
209 | |||
210 | try | 179 | try |
211 | { | 180 | { |
181 | Bitmap image = new Bitmap(stream); | ||
182 | Size newsize; | ||
183 | |||
184 | // TODO: make this a bit less hard coded | ||
185 | if ((image.Height < 64) && (image.Width < 64)) | ||
186 | { | ||
187 | newsize = new Size(32, 32); | ||
188 | } | ||
189 | else if ((image.Height < 128) && (image.Width < 128)) | ||
190 | { | ||
191 | newsize = new Size(64, 64); | ||
192 | } | ||
193 | else if ((image.Height < 256) && (image.Width < 256)) | ||
194 | { | ||
195 | newsize = new Size(128, 128); | ||
196 | } | ||
197 | else if ((image.Height < 512 && image.Width < 512)) | ||
198 | { | ||
199 | newsize = new Size(256, 256); | ||
200 | } | ||
201 | else if ((image.Height < 1024 && image.Width < 1024)) | ||
202 | { | ||
203 | newsize = new Size(512, 512); | ||
204 | } | ||
205 | else | ||
206 | { | ||
207 | newsize = new Size(1024, 1024); | ||
208 | } | ||
209 | |||
210 | Bitmap resize = new Bitmap(image, newsize); | ||
211 | |||
212 | imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); | 212 | imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); |
213 | } | 213 | } |
214 | catch (Exception) | 214 | catch (Exception) |
215 | { | 215 | { |
216 | m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Encode Failed. Empty byte data returned!"); | 216 | m_log.Error("[LOADIMAGEURLMODULE]: OpenJpeg Conversion Failed. Empty byte data returned!"); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | else | 219 | else |