aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/LoadImageURLModule.cs')
-rw-r--r--OpenSim/Region/Environment/Modules/LoadImageURLModule.cs33
1 files changed, 15 insertions, 18 deletions
diff --git a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
index 8b8b386..9d10fc3 100644
--- a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
+++ b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs
@@ -1,18 +1,16 @@
1using System; 1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Net;
5using System.IO;
6using System.Drawing; 2using System.Drawing;
3using System.IO;
4using System.Net;
7using libsecondlife; 5using libsecondlife;
6using Nini.Config;
8using OpenJPEGNet; 7using OpenJPEGNet;
9using OpenSim.Region.Environment.Scenes;
10using OpenSim.Region.Environment.Interfaces; 8using OpenSim.Region.Environment.Interfaces;
11using Nini.Config; 9using OpenSim.Region.Environment.Scenes;
12 10
13namespace OpenSim.Region.Environment.Modules 11namespace OpenSim.Region.Environment.Modules
14{ 12{
15 public class LoadImageURLModule : IRegionModule , IDynamicTextureRender 13 public class LoadImageURLModule : IRegionModule, IDynamicTextureRender
16 { 14 {
17 private string m_name = "LoadImageURL"; 15 private string m_name = "LoadImageURL";
18 private IDynamicTextureManager m_textureManager; 16 private IDynamicTextureManager m_textureManager;
@@ -85,25 +83,25 @@ namespace OpenSim.Region.Environment.Modules
85 private void MakeHttpRequest(string url, LLUUID requestID) 83 private void MakeHttpRequest(string url, LLUUID requestID)
86 { 84 {
87 WebRequest request = HttpWebRequest.Create(url); 85 WebRequest request = HttpWebRequest.Create(url);
88 RequestState state = new RequestState((HttpWebRequest)request, requestID); 86 RequestState state = new RequestState((HttpWebRequest) request, requestID);
89 IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); 87 IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
90 88
91 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1)); 89 TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
92 state.TimeOfRequest = (int)t.TotalSeconds; 90 state.TimeOfRequest = (int) t.TotalSeconds;
93 } 91 }
94 92
95 private void HttpRequestReturn(IAsyncResult result) 93 private void HttpRequestReturn(IAsyncResult result)
96 { 94 {
97 RequestState state = (RequestState)result.AsyncState; 95 RequestState state = (RequestState) result.AsyncState;
98 WebRequest request = (WebRequest)state.Request; 96 WebRequest request = (WebRequest) state.Request;
99 HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result); 97 HttpWebResponse response = (HttpWebResponse) request.EndGetResponse(result);
100 if (response.StatusCode == HttpStatusCode.OK) 98 if (response.StatusCode == HttpStatusCode.OK)
101 { 99 {
102 Bitmap image = new Bitmap(response.GetResponseStream()); 100 Bitmap image = new Bitmap(response.GetResponseStream());
103 Bitmap resize = new Bitmap(image, new Size(512, 512)); 101 Bitmap resize = new Bitmap(image, new Size(512, 512));
104 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); 102 byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true);
105 103
106 m_textureManager.ReturnData(state.RequestID, imageJ2000); 104 m_textureManager.ReturnData(state.RequestID, imageJ2000);
107 } 105 }
108 } 106 }
109 107
@@ -119,6 +117,5 @@ namespace OpenSim.Region.Environment.Modules
119 RequestID = requestID; 117 RequestID = requestID;
120 } 118 }
121 } 119 }
122
123 } 120 }
124} 121} \ No newline at end of file