aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs20
1 files changed, 13 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 90c48d0..2640f08 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -50,7 +50,8 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
50 private string m_name = "VectorRenderModule"; 50 private string m_name = "VectorRenderModule";
51 private Scene m_scene; 51 private Scene m_scene;
52 private IDynamicTextureManager m_textureManager; 52 private IDynamicTextureManager m_textureManager;
53 53 private Graphics m_graph;
54
54 public VectorRenderModule() 55 public VectorRenderModule()
55 { 56 {
56 } 57 }
@@ -96,14 +97,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
96 public void GetDrawStringSize(string text, string fontName, int fontSize, 97 public void GetDrawStringSize(string text, string fontName, int fontSize,
97 out double xSize, out double ySize) 98 out double xSize, out double ySize)
98 { 99 {
99 Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
100 Graphics graph = Graphics.FromImage(bitmap);
101
102 Font myFont = new Font(fontName, fontSize); 100 Font myFont = new Font(fontName, fontSize);
103 SizeF stringSize = new SizeF(); 101 SizeF stringSize = new SizeF();
104 stringSize = graph.MeasureString(text, myFont); 102 lock (m_graph) {
105 xSize = stringSize.Width; 103 stringSize = m_graph.MeasureString(text, myFont);
106 ySize = stringSize.Height; 104 xSize = stringSize.Width;
105 ySize = stringSize.Height;
106 }
107 } 107 }
108 108
109 109
@@ -117,6 +117,12 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
117 { 117 {
118 m_scene = scene; 118 m_scene = scene;
119 } 119 }
120
121 if (m_graph == null)
122 {
123 Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
124 m_graph = Graphics.FromImage(bitmap);
125 }
120 } 126 }
121 127
122 public void PostInitialise() 128 public void PostInitialise()