aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKevin Cozens2018-04-27 16:48:35 -0400
committerKevin Cozens2018-04-27 16:48:35 -0400
commit8af2d99ba9bffc8986f83944f6e8a6d90fb7fb6c (patch)
treef2b110f7c45093d2ea7b1322e239f408b526ed51
parentfix http keep alive header (diff)
downloadopensim-SC-8af2d99ba9bffc8986f83944f6e8a6d90fb7fb6c.zip
opensim-SC-8af2d99ba9bffc8986f83944f6e8a6d90fb7fb6c.tar.gz
opensim-SC-8af2d99ba9bffc8986f83944f6e8a6d90fb7fb6c.tar.bz2
opensim-SC-8af2d99ba9bffc8986f83944f6e8a6d90fb7fb6c.tar.xz
Do dispose and new Font only once when handling FontProp drawing command.
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs45
1 files changed, 12 insertions, 33 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 8a26ab7..f4efb0a 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -493,6 +493,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
493 Point endPoint = new Point(0, 0); 493 Point endPoint = new Point(0, 0);
494 Pen drawPen = null; 494 Pen drawPen = null;
495 Font myFont = null; 495 Font myFont = null;
496 FontStyle myFontStyle;
496 SolidBrush myBrush = null; 497 SolidBrush myBrush = null;
497 498
498 try 499 try
@@ -663,59 +664,37 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
663 } 664 }
664 else if (nextLine.StartsWith("FontProp")) 665 else if (nextLine.StartsWith("FontProp"))
665 { 666 {
667 myFontStyle = FontStyle.Regular;
668
666 nextLine = nextLine.Remove(0, 8); 669 nextLine = nextLine.Remove(0, 8);
667 nextLine = nextLine.Trim(); 670 nextLine = nextLine.Trim();
668 671
669 string[] fprops = nextLine.Split(partsDelimiter); 672 string[] fprops = nextLine.Split(partsDelimiter);
670 foreach (string prop in fprops) 673 foreach (string prop in fprops)
671 { 674 {
672
673 switch (prop) 675 switch (prop)
674 { 676 {
675 case "B": 677 case "B":
676 if (!(myFont.Bold)) 678 myFontStyle |= FontStyle.Bold;
677 {
678 Font newFont = new Font(myFont, myFont.Style | FontStyle.Bold);
679 myFont.Dispose();
680 myFont = newFont;
681 }
682 break; 679 break;
683 case "I": 680 case "I":
684 if (!(myFont.Italic)) 681 myFontStyle |= FontStyle.Italic;
685 {
686 Font newFont = new Font(myFont, myFont.Style | FontStyle.Italic);
687 myFont.Dispose();
688 myFont = newFont;
689 }
690 break; 682 break;
691 case "U": 683 case "U":
692 if (!(myFont.Underline)) 684 myFontStyle |= FontStyle.Underline;
693 {
694 Font newFont = new Font(myFont, myFont.Style | FontStyle.Underline);
695 myFont.Dispose();
696 myFont = newFont;
697 }
698 break; 685 break;
699 case "S": 686 case "S":
700 if (!(myFont.Strikeout)) 687 myFontStyle |= FontStyle.Strikeout;
701 {
702 Font newFont = new Font(myFont, myFont.Style | FontStyle.Strikeout);
703 myFont.Dispose();
704 myFont = newFont;
705 }
706 break; 688 break;
707 case "R": 689 case "R":
708 // We need to place this newFont inside its own context so that the .NET compiler 690 myFontStyle = FontStyle.Regular;
709 // doesn't complain about a redefinition of an existing newFont, even though there is none
710 // The mono compiler doesn't produce this error.
711 {
712 Font newFont = new Font(myFont, FontStyle.Regular);
713 myFont.Dispose();
714 myFont = newFont;
715 }
716 break; 691 break;
717 } 692 }
718 } 693 }
694
695 Font newFont = new Font(myFont, myFontStyle);
696 myFont.Dispose();
697 myFont = newFont;
719 } 698 }
720 else if (nextLine.StartsWith("FontName")) 699 else if (nextLine.StartsWith("FontName"))
721 { 700 {