private void PrepareRenderData(int width, int height) { if (ForegroundTexture != null) { ForegroundTexture.Dispose(); } ForegroundTexture = new RenderTarget2D(Game.GraphicsDevice, width, height); if (BackgroundTexture != null) { BackgroundTexture.Dispose(); } BackgroundTexture = new RenderTarget2D(Game.GraphicsDevice, width, height); }
/// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected override void Dispose(bool disposing) { if (!_disposed) { if (disposing) { GorgonSpriteEditorPlugIn.Settings.Save(); // Clear any external dependencies. EditorFile = null; if (BackgroundTexture != null) { BackgroundTexture.Dispose(); } if (_swap != null) { _swap.Dispose(); } if (Renderer != null) { Renderer.Dispose(); } } } _disposed = true; Texture = null; BackgroundTexture = null; Renderer = null; _swap = null; base.Dispose(disposing); }