예제 #1
0
        /// <summary>
        /// アンマネージ リソースの解放およびリセットに関連付けられているアプリケーション定義のタスクを実行します。
        /// </summary>
        public void Dispose()
        {
            foreach (var screenContext in screenContexts)
            {
                screenContext.Value.Dispose();
            }
            if (CullingRasterizerState != null && !CullingRasterizerState.Disposed)
            {
                CullingRasterizerState.Dispose();
            }
            if (NonCullingRasterizerState != null && !NonCullingRasterizerState.Disposed)
            {
                NonCullingRasterizerState.Dispose();
            }
            foreach (var disposable in Disposables)
            {
                disposable.Dispose();
            }
            if (D2DFactory != null && !D2DFactory.Disposed)
            {
                D2DFactory.Dispose();
            }
            if (DWFactory != null && !DWFactory.Disposed)
            {
                DWFactory.Dispose();
            }

            if (disposeDeviceManager)
            {
                DeviceManager.Dispose();
            }
        }
예제 #2
0
 protected virtual void DisposeDirectXResources()
 {
     DwFactory?.Dispose();
     RenderTarget?.Dispose();
     D2DFactory?.Dispose();
     D3DDevice?.Dispose();
 }
예제 #3
0
        protected override void DisposeManagedResources()
        {
            FreeResources();

            _factory.Dispose();

            base.DisposeManagedResources();
        }
예제 #4
0
 protected virtual void DisposeDirectXResources()
 {
     DwFactory.Dispose();
     RenderTarget.Dispose();
     RenderTargetView.Dispose();
     D2DFactory.Dispose();
     SwapChain.Dispose();
     D3DDeviceContext.Dispose();
     D3DDevice.Dispose();
 }
예제 #5
0
 protected override void Dispose(bool disposing)
 {
     if (Disposing)
     {
         DisposeRenderObjects();
         if (D2DFactory != null)
         {
             D2DFactory.Dispose();
             D2DFactory = null;
         }
     }
     base.Dispose(disposing);
 }
예제 #6
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                //dispose of all layouts
                while (layouts.Keys.Count > 0)
                {
                    foreach (string key in layouts.Keys)
                    {
                        layouts[key].Dispose();
                        layouts.Remove(key);
                        break;
                    }
                }

                if (brush != null)
                {
                    brush.Dispose();
                }
                brush = null;
                if (dcRenderTarget != null)
                {
                    dcRenderTarget.Dispose();
                }
                dcRenderTarget = null;
                if (dwriteFactory != null)
                {
                    dwriteFactory.Dispose();
                }
                dwriteFactory = null;
                if (d2DFactory != null)
                {
                    d2DFactory.Dispose();
                }
                d2DFactory = null;
            }
            base.Dispose(disposing);
        }
예제 #7
0
        public void Dispose()
        {
            foreach (KeyValuePair <string, D2D1.Brush> p in Brushes)
            {
                p.Value.Dispose();
            }
            DashStyle.Dispose();

            D2DTarget.Dispose();
            D2DDevice.Dispose();
            D2DContext.Dispose();
            D2DFactory.Dispose();

            BlackTextureView.Dispose();
            WhiteTextureView.Dispose();
            AnisotropicSampler.Dispose();

            blendStateOpaque.Dispose();
            blendStateTransparent.Dispose();

            rasterizerStateSolidCullBack.Dispose();
            rasterizerStateWireframeCullBack.Dispose();
            rasterizerStateSolidNoCull.Dispose();
            rasterizerStateWireframeNoCull.Dispose();
            depthStencilStateDefault.Dispose();
            depthStencilStateNoDepth.Dispose();

            foreach (Camera c in Cameras)
            {
                c.Dispose();
            }
            constantBuffer.Dispose();

            swapChain.Dispose();
            Device.Dispose();
            Context.Dispose();
        }
예제 #8
0
 public virtual void Dispose()
 {
     D2DFactory?.Dispose();
     WicFactory?.Dispose();
     DwFactory?.Dispose();
 }
예제 #9
0
        /// <summary>
        /// Dispose of resources (IDisposable implementation)
        /// </summary>
        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && !disposed)
            {
                lock (renderSyncObject)
                {
                    render = null;

                    lock (sharedSyncObject)
                    {
                        if (sharedD2DFactory != null && d2DFactory == sharedD2DFactory)
                        {
                            sharedRefCount--;
                        }

                        if (d2DFactory != null && d2DFactory != sharedD2DFactory)
                        {
                            d2DFactory.Dispose();
                        }
                        d2DFactory = null;

                        if (dwriteFactory != null && dwriteFactory != sharedDwriteFactory)
                        {
                            dwriteFactory.Dispose();
                        }
                        dwriteFactory = null;

                        if (wicFactory != null && wicFactory != sharedWicFactory)
                        {
                            wicFactory.Dispose();
                        }
                        wicFactory = null;

                        if (sharedRefCount == 0)
                        {
                            if (sharedD2DFactory != null)
                            {
                                sharedD2DFactory.Dispose();
                            }
                            sharedD2DFactory = null;

                            if (sharedDwriteFactory != null)
                            {
                                sharedDwriteFactory.Dispose();
                            }
                            sharedDwriteFactory = null;

                            if (sharedWicFactory != null)
                            {
                                sharedWicFactory.Dispose();
                            }
                            sharedWicFactory = null;
                        }
                    }

                    foreach (DrawingShape shape in drawingShapes)
                    {
                        shape.Dispose();
                    }

                    if (bitmap != null)
                    {
                        bitmap.Dispose();
                    }
                    bitmap = null;

                    if (dcRenderTarget != null)
                    {
                        dcRenderTarget.Dispose();
                    }
                    dcRenderTarget = null;
                    if (bitmapRenderTarget != null)
                    {
                        bitmapRenderTarget.Dispose();
                    }
                    bitmapRenderTarget = null;
                    if (hwndRenderTarget != null)
                    {
                        hwndRenderTarget.Dispose();
                    }
                    hwndRenderTarget = null;


                    disposed = true;
                }
            }
            base.Dispose(disposing);
        }