diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/LoadImageURLModule.cs | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs index dc894e4..0548b9d 100644 --- a/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs +++ b/OpenSim/Region/Environment/Modules/LoadImageURLModule.cs | |||
@@ -126,7 +126,35 @@ namespace OpenSim.Region.Environment.Modules | |||
126 | if (response.StatusCode == HttpStatusCode.OK) | 126 | if (response.StatusCode == HttpStatusCode.OK) |
127 | { | 127 | { |
128 | Bitmap image = new Bitmap(response.GetResponseStream()); | 128 | Bitmap image = new Bitmap(response.GetResponseStream()); |
129 | Bitmap resize = new Bitmap(image, new Size(1024, 1024)); | 129 | Size newsize; |
130 | |||
131 | // TODO: make this a bit less hard coded | ||
132 | if ((image.Height < 64) && (image.Width < 64)) | ||
133 | { | ||
134 | newsize = new Size(32, 32); | ||
135 | } | ||
136 | else if ((image.Height < 128) && (image.Width < 128)) | ||
137 | { | ||
138 | newsize = new Size(64, 64); | ||
139 | } | ||
140 | else if ((image.Height <256) && (image.Width < 256)) | ||
141 | { | ||
142 | newsize = new Size(128, 128); | ||
143 | } | ||
144 | else if ((image.Height < 512 && image.Width < 512)) | ||
145 | { | ||
146 | newsize = new Size(256, 256); | ||
147 | } | ||
148 | else if ((image.Height < 1024 && image.Width < 1024)) | ||
149 | { | ||
150 | newsize = new Size(512, 512); | ||
151 | } | ||
152 | else | ||
153 | { | ||
154 | newsize = new Size(1024,1024); | ||
155 | } | ||
156 | |||
157 | Bitmap resize = new Bitmap(image, newsize); | ||
130 | byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); | 158 | byte[] imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); |
131 | 159 | ||
132 | m_textureManager.ReturnData(state.RequestID, imageJ2000); | 160 | m_textureManager.ReturnData(state.RequestID, imageJ2000); |