diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs | 42 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | 24 |
2 files changed, 51 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs index b50c0bd..41baccc 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs | |||
@@ -57,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
57 | 57 | ||
58 | m_dtm = new DynamicTextureModule(); | 58 | m_dtm = new DynamicTextureModule(); |
59 | m_dtm.ReuseTextures = reuseTextures; | 59 | m_dtm.ReuseTextures = reuseTextures; |
60 | // m_dtm.ReuseLowDataTextures = reuseTextures; | ||
60 | 61 | ||
61 | m_vrm = new VectorRenderModule(); | 62 | m_vrm = new VectorRenderModule(); |
62 | 63 | ||
@@ -201,6 +202,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
201 | public void TestRepeatSameDrawReusingTexture() | 202 | public void TestRepeatSameDrawReusingTexture() |
202 | { | 203 | { |
203 | TestHelpers.InMethod(); | 204 | TestHelpers.InMethod(); |
205 | // TestHelpers.EnableLogging(); | ||
204 | 206 | ||
205 | string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; | 207 | string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; |
206 | 208 | ||
@@ -228,6 +230,46 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests | |||
228 | Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | 230 | Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); |
229 | } | 231 | } |
230 | 232 | ||
233 | /// <summary> | ||
234 | /// Test a low data dynamically generated texture such that it is treated as a low data texture that causes | ||
235 | /// problems for current viewers. | ||
236 | /// </summary> | ||
237 | /// <remarks> | ||
238 | /// As we do not set DynamicTextureModule.ReuseLowDataTextures = true in this test, it should not reuse the | ||
239 | /// texture | ||
240 | /// </remarks> | ||
241 | [Test] | ||
242 | public void TestRepeatSameDrawLowDataTexture() | ||
243 | { | ||
244 | TestHelpers.InMethod(); | ||
245 | // TestHelpers.EnableLogging(); | ||
246 | |||
247 | string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; | ||
248 | |||
249 | SetupScene(true); | ||
250 | SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); | ||
251 | |||
252 | m_dtm.AddDynamicTextureData( | ||
253 | m_scene.RegionInfo.RegionID, | ||
254 | so.UUID, | ||
255 | m_vrm.GetContentType(), | ||
256 | dtText, | ||
257 | "1024", | ||
258 | 0); | ||
259 | |||
260 | UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; | ||
261 | |||
262 | m_dtm.AddDynamicTextureData( | ||
263 | m_scene.RegionInfo.RegionID, | ||
264 | so.UUID, | ||
265 | m_vrm.GetContentType(), | ||
266 | dtText, | ||
267 | "1024", | ||
268 | 0); | ||
269 | |||
270 | Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); | ||
271 | } | ||
272 | |||
231 | [Test] | 273 | [Test] |
232 | public void TestRepeatSameDrawDifferentExtraParamsReusingTexture() | 274 | public void TestRepeatSameDrawDifferentExtraParamsReusingTexture() |
233 | { | 275 | { |
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 0e7051e..d82551e 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs | |||
@@ -35,6 +35,7 @@ using System.Net; | |||
35 | using Nini.Config; | 35 | using Nini.Config; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenMetaverse.Imaging; | 37 | using OpenMetaverse.Imaging; |
38 | using OpenSim.Region.CoreModules.Scripting.DynamicTexture; | ||
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
40 | using log4net; | 41 | using log4net; |
@@ -85,20 +86,14 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
85 | // return lines.Any((str, r) => str.StartsWith("Image")); | 86 | // return lines.Any((str, r) => str.StartsWith("Image")); |
86 | // } | 87 | // } |
87 | 88 | ||
88 | public byte[] ConvertUrl(string url, string extraParams) | 89 | public IDynamicTexture ConvertUrl(string url, string extraParams) |
89 | { | 90 | { |
90 | return null; | 91 | return null; |
91 | } | 92 | } |
92 | 93 | ||
93 | public byte[] ConvertData(string bodyData, string extraParams) | 94 | public IDynamicTexture ConvertData(string bodyData, string extraParams) |
94 | { | 95 | { |
95 | bool reuseable; | 96 | return Draw(bodyData, extraParams); |
96 | return Draw(bodyData, extraParams, out reuseable); | ||
97 | } | ||
98 | |||
99 | private byte[] ConvertData(string bodyData, string extraParams, out bool reuseable) | ||
100 | { | ||
101 | return Draw(bodyData, extraParams, out reuseable); | ||
102 | } | 97 | } |
103 | 98 | ||
104 | public bool AsyncConvertUrl(UUID id, string url, string extraParams) | 99 | public bool AsyncConvertUrl(UUID id, string url, string extraParams) |
@@ -109,10 +104,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
109 | public bool AsyncConvertData(UUID id, string bodyData, string extraParams) | 104 | public bool AsyncConvertData(UUID id, string bodyData, string extraParams) |
110 | { | 105 | { |
111 | // XXX: This isn't actually being done asynchronously! | 106 | // XXX: This isn't actually being done asynchronously! |
112 | bool reuseable; | 107 | m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); |
113 | byte[] data = ConvertData(bodyData, extraParams, out reuseable); | ||
114 | |||
115 | m_textureManager.ReturnData(id, data, reuseable); | ||
116 | 108 | ||
117 | return true; | 109 | return true; |
118 | } | 110 | } |
@@ -191,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
191 | 183 | ||
192 | #endregion | 184 | #endregion |
193 | 185 | ||
194 | private byte[] Draw(string data, string extraParams, out bool reuseable) | 186 | private IDynamicTexture Draw(string data, string extraParams) |
195 | { | 187 | { |
196 | // We need to cater for old scripts that didnt use extraParams neatly, they use either an integer size which represents both width and height, or setalpha | 188 | // We need to cater for old scripts that didnt use extraParams neatly, they use either an integer size which represents both width and height, or setalpha |
197 | // we will now support multiple comma seperated params in the form width:256,height:512,alpha:255 | 189 | // we will now support multiple comma seperated params in the form width:256,height:512,alpha:255 |
@@ -334,6 +326,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
334 | 326 | ||
335 | Bitmap bitmap = null; | 327 | Bitmap bitmap = null; |
336 | Graphics graph = null; | 328 | Graphics graph = null; |
329 | bool reuseable = false; | ||
337 | 330 | ||
338 | try | 331 | try |
339 | { | 332 | { |
@@ -396,7 +389,8 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender | |||
396 | e.Message, e.StackTrace); | 389 | e.Message, e.StackTrace); |
397 | } | 390 | } |
398 | 391 | ||
399 | return imageJ2000; | 392 | return new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture( |
393 | data, extraParams, imageJ2000, new Size(width, height), reuseable); | ||
400 | } | 394 | } |
401 | finally | 395 | finally |
402 | { | 396 | { |