/// <summary> /// Keeps the text view data in sync with this surface. /// </summary> protected virtual void ResetArea() { RenderRects = new Rectangle[area.Width * area.Height]; RenderCells = new Cell[area.Width * area.Height]; int index = 0; for (int y = 0; y < area.Height; y++) { for (int x = 0; x < area.Width; x++) { RenderRects[index] = font.GetRenderRect(x, y); RenderCells[index] = cells[(y + area.Top) * width + (x + area.Left)]; index++; } } // TODO: Optimization by calculating AbsArea and seeing if it's diff from current, if so, don't create new RenderRects AbsoluteArea = new Rectangle(0, 0, area.Width * font.Size.X, area.Height * font.Size.Y); if (BackbufferImage != null) { BackbufferImage.Dispose(); } BackbufferImage = new Bitmap(AbsoluteArea.Width, AbsoluteArea.Height); if (Backbuffer != null) { Backbuffer.Dispose(); } Backbuffer = Graphics.FromImage(BackbufferImage); }
/// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { Backbuffer.Dispose(); components.Dispose(); } base.Dispose(disposing); }
internal static void DisposeDevice() { ForceWindowed(); OnDeviceEnd(); m_initialized = false; MyHBAO.ReleaseScreenResources(); if (MyGBuffer.Main != null) { MyGBuffer.Main.Release(); MyGBuffer.Main = null; } if (Backbuffer != null) { Backbuffer.Release(); Backbuffer = null; } if (m_swapchain != null) { m_swapchain.Dispose(); m_swapchain = null; } if (RC != null) { RC.Dispose(); RC = null; } if (Device != null) { #if DEBUG if (VRage.MyCompilationSymbols.DX11Debug) { var deviceDebug = new DeviceDebug(Device); deviceDebug.ReportLiveDeviceObjects(ReportingLevel.Detail | ReportingLevel.Summary); deviceDebug.Dispose(); } #endif Device.Dispose(); Device = null; WIC = null; } if (m_factory != null) { m_factory.Dispose(); m_factory = null; } }
public void Dispose() { if (BackbufferImage != null) { BackbufferImage.Dispose(); } if (Backbuffer != null) { Backbuffer.Dispose(); } }
internal static void DisposeDevice() { ForceWindowed(); OnDeviceEnd(); if (MyGBuffer.Main != null) { MyGBuffer.Main.Release(); MyGBuffer.Main = null; } if (Backbuffer != null) { Backbuffer.Release(); Backbuffer = null; } if (m_swapchain != null) { m_swapchain.Dispose(); m_swapchain = null; } if (DeviceContext != null) { DeviceContext.Dispose(); DeviceContext = null; } if (Device != null) { #if DEBUG if (VRage.MyCompilationSymbols.DX11Debug) { var deviceDebug = new DeviceDebug(Device); deviceDebug.ReportLiveDeviceObjects(ReportingLevel.Detail | ReportingLevel.Summary); deviceDebug.Dispose(); } #endif Device.Dispose(); Device = null; } if (m_factory != null) { m_factory.Dispose(); m_factory = null; } }
internal static void DisposeDevice() { ForceWindowed(); OnDeviceEnd(); if (MyGBuffer.Main != null) { MyGBuffer.Main.Release(); MyGBuffer.Main = null; } if (Backbuffer != null) { Backbuffer.Release(); Backbuffer = null; } if (m_swapchain != null) { m_swapchain.Dispose(); m_swapchain = null; } if (ImmediateContext != null) { ImmediateContext.Dispose(); ImmediateContext = null; } if (Device != null) { #if DEBUG_DEVICE var deviceDebug = new DeviceDebug(Device); deviceDebug.ReportLiveDeviceObjects(ReportingLevel.Detail); deviceDebug.Dispose(); #endif Device.Dispose(); Device = null; } if (m_factory != null) { m_factory.Dispose(); m_factory = null; } }
// Load and Create buffer function to handle the event private void ctlBreakout_Load_and_CreateBackBuffer(object sender, EventArgs e) { SoundPlayer sndVoid = new SoundPlayer(ctlBreakoutLib.Properties.Resources.Void); sndVoid.Play(); var parent = this.Parent; while (!(parent is Form)) { parent = parent.Parent; } pForm = parent as Form;; if (Backbuffer != null) { Backbuffer.Dispose(); } Backbuffer = new Bitmap(PlayGround.Width, PlayGround.Height); }