Fix texture memory leak. (Thanks lavacraft)

This commit is contained in:
UnknownShadow200 2016-07-05 12:40:06 +10:00
parent 63d71cfa2b
commit 6102a4f2ce
3 changed files with 3 additions and 2 deletions

View File

@ -54,6 +54,7 @@ namespace ClassicalSharp.Gui {
Size bodySize = CalculateContentSize( e, sizes, out elementSize );
int titleWidth = MeasureTitles( font ), titleHeight = elements[0].TitleSize.Height;
Size size = new Size( Math.Max( bodySize.Width, titleWidth ), bodySize.Height + titleHeight );
game.Graphics.DeleteTexture( ref texture );
using( Bitmap bmp = IDrawer2D.CreatePow2Bitmap( size ) )
using( IDrawer2D drawer = game.Drawer2D )
@ -72,7 +73,6 @@ namespace ClassicalSharp.Gui {
public override bool HandlesMouseClick( int mouseX, int mouseY, MouseButton button ) {
mouseX -= X; mouseY -= Y;
if( IntersectsHeader( mouseX, mouseY ) ) {
Dispose();
Redraw();
} else {
IntersectsBody( mouseX, mouseY );

View File

@ -193,6 +193,7 @@ namespace ClassicalSharp.Gui {
Dispose();
api.DeleteTexture( ref caretTex );
api.DeleteTexture( ref prefixTex );
altText.Dispose();
}
public override void MoveTo( int newX, int newY ) {

View File

@ -321,7 +321,7 @@ namespace ClassicalSharp {
int http = value.IndexOf( "http://", index );
int https = value.IndexOf( "https://", index );
return http == index || https == index;
}
}
/// <summary> Conversion for code page 437 characters from index 0 to 31 to unicode. </summary>
public const string ControlCharReplacements = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼";