diff options
author | Sean Dague | 2008-02-15 15:55:23 +0000 |
---|---|---|
committer | Sean Dague | 2008-02-15 15:55:23 +0000 |
commit | 4cc5aac18bab0d8bdcf78bcb6f6c497ca4375d51 (patch) | |
tree | 27df7001ec6354ab8c9f8bb86ec5b161e6ad5daf /OpenSim/Region/Environment/Modules | |
parent | allow for 1024x1024 textures through osSetDynamicTextureURL. Follow up patch (diff) | |
download | opensim-SC_OLD-4cc5aac18bab0d8bdcf78bcb6f6c497ca4375d51.zip opensim-SC_OLD-4cc5aac18bab0d8bdcf78bcb6f6c497ca4375d51.tar.gz opensim-SC_OLD-4cc5aac18bab0d8bdcf78bcb6f6c497ca4375d51.tar.bz2 opensim-SC_OLD-4cc5aac18bab0d8bdcf78bcb6f6c497ca4375d51.tar.xz |
be smarter about the size of dynamic textures that we pull in
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-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); |