Esempio n. 1
0
        /// <summary>
        /// Releases resources associated with the object.
        /// </summary>
        /// <param name="disposing">true if the object is being disposed; false if the object is being finalized.</param>
        protected override void Dispose(Boolean disposing)
        {
            if (Disposed)
            {
                return;
            }

            if (disposing)
            {
                var glname = program;
                if (glname != 0 && !Ultraviolet.Disposed)
                {
                    Ultraviolet.QueueWorkItem((state) =>
                    {
                        gl.DeleteProgram(glname);
                        gl.ThrowIfError();
                    }, this, WorkItemOptions.ReturnNullOnSynchronousExecution);
                }

                if (programOwnsShaders)
                {
                    SafeDispose.Dispose(vertexShader);
                    SafeDispose.Dispose(fragmentShader);
                }

                program = 0;
            }

            base.Dispose(disposing);
        }
Esempio n. 2
0
        /// <summary>
        /// Releases resources associated with the object.
        /// </summary>
        /// <param name="disposing">true if the object is being disposed; false if the object is being finalized.</param>
        protected override void Dispose(Boolean disposing)
        {
            if (Disposed)
            {
                return;
            }

            if (disposing)
            {
                if (!Ultraviolet.Disposed)
                {
                    ((OpenGLUltravioletGraphics)Ultraviolet.GetGraphics()).UnbindTexture(this);
                }

                if (willNotBeSampled)
                {
                    if (!Ultraviolet.Disposed && renderbuffer != 0)
                    {
                        Ultraviolet.QueueWorkItem((state) =>
                        {
                            gl.DeleteRenderBuffers(((OpenGLRenderBuffer2D)state).renderbuffer);
                            gl.ThrowIfError();
                        }, this);
                    }
                }
                else
                {
                    SafeDispose.Dispose(texture);
                }
            }

            base.Dispose(disposing);
        }
        /// <summary>
        /// Releases resources associated with the object.
        /// </summary>
        /// <param name="disposing">true if the object is being disposed; false if the object is being finalized.</param>
        protected override void Dispose(Boolean disposing)
        {
            if (Disposed)
            {
                return;
            }

            if (samplerObjects != null)
            {
                for (int i = 0; i < samplerObjects.Length; i++)
                {
                    SafeDispose.Dispose(samplerObjects[i]);
                }
            }

            if (gl.Initialized)
            {
                gl.Uninitialize();
            }

            SDL_GL_DeleteContext(context);
            context = IntPtr.Zero;

            base.Dispose(disposing);
        }
        /// <summary>
        /// Releases resources associated with the object.
        /// </summary>
        /// <param name="disposing">true if the object is being disposed; false if the object is being finalized.</param>
        protected override void Dispose(Boolean disposing)
        {
            if (Disposed)
            {
                return;
            }

            if (disposing)
            {
                if (!Ultraviolet.Disposed)
                {
                    Ultraviolet.QueueWorkItem((state) =>
                    {
                        gl.DeleteProgram(((OpenGLShaderProgram)state).program);
                        gl.ThrowIfError();
                    }, this);
                }

                if (programOwnsShaders)
                {
                    SafeDispose.Dispose(vertexShader);
                    SafeDispose.Dispose(fragmentShader);
                }
            }

            base.Dispose(disposing);
        }
Esempio n. 5
0
 /// <summary>
 /// Invalidates the cached state objects.
 /// </summary>
 private static void InvalidateCache()
 {
     SafeDispose.DisposeRef(ref cachedOpaque);
     SafeDispose.DisposeRef(ref cachedAlphaBlend);
     SafeDispose.DisposeRef(ref cachedAdditive);
     SafeDispose.DisposeRef(ref cachedNonPremultiplied);
 }
Esempio n. 6
0
        /// <summary>
        /// Releases resources associated with the object.
        /// </summary>
        /// <param name="disposing"><see langword="true"/> if the object is being disposed;
        /// <see langword="false"/> if the object is being finalized.</param>
        protected virtual void Dispose(Boolean disposing)
        {
            if (Disposed)
            {
                return;
            }

            if (disposing)
            {
                SafeDispose.Dispose(GetUI());
                SafeDispose.Dispose(GetInput());
                SafeDispose.Dispose(GetContent());
                SafeDispose.Dispose(GetPlatform());
                SafeDispose.Dispose(GetGraphics());
                SafeDispose.Dispose(GetAudio());
            }

            WaitForPendingTasks(true);

            this.Disposing = true;

            ProcessWorkItems();
            OnShutdown();

            ChangeSynchronizationContext(null);

            this.Disposed  = true;
            this.Disposing = false;

            ReleaseContext();
        }
Esempio n. 7
0
 /// <summary>
 /// Releases resources associated with this object.
 /// </summary>
 /// <param name="disposing"><see langword="true"/> if the object is being disposed; <see langword="false"/> if the object is being finalized.</param>
 protected override void Dispose(Boolean disposing)
 {
     if (disposing && !Disposed)
     {
         SafeDispose.Dispose(screenStacks);
     }
     base.Dispose(disposing);
 }
Esempio n. 8
0
 /// <inheritdoc/>
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.DisposeRef(ref instanceManager);
     }
     base.Dispose(disposing);
 }
Esempio n. 9
0
        public void SetsReferenceToNull()
        {
            IDisposable myDisposable = DisposableFactory.CreateDisposable();

            SafeDispose.DisposeAndSetNull(ref myDisposable);

            Assert.Equal(null, myDisposable);
        }
Esempio n. 10
0
        /// <inheritdoc/>
        protected override void CleanupOverride()
        {
            SafeDispose.DisposeRef(ref geometryStream);
            SafeDispose.DisposeRef(ref vbuffer);
            SafeDispose.DisposeRef(ref effect);

            base.CleanupOverride();
        }
Esempio n. 11
0
 /// <summary>
 /// Releases resources associated with this object.
 /// </summary>
 /// <param name="disposing"><see langword="true"/> if the object is being disposed; <see langword="false"/> if the object is being finalized.</param>
 private void Dispose(Boolean disposing)
 {
     if (disposing && !disposed)
     {
         SafeDispose.Dispose(spriteBatch);
     }
     disposed = true;
 }
Esempio n. 12
0
 /// <summary>
 /// Releases resources associated with the object.
 /// </summary>
 /// <param name="disposing"><see langword="true"/> if the object is being disposed; <see langword="false"/> if the object is being finalized.</param>
 protected virtual void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.Dispose(txtWriter);
         SafeDispose.Dispose(strWriter);
     }
 }
Esempio n. 13
0
 /// <summary>
 /// Releases resources associated with the object.
 /// </summary>
 /// <param name="disposing"><see langword="true"/> if the object is being disposed; <see langword="false"/> if the object is being finalized.</param>
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.Dispose(texture);
     }
     base.Dispose(disposing);
 }
Esempio n. 14
0
 /// <inheritdoc/>
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.Dispose(escMenuDialog);
     }
     base.Dispose(disposing);
 }
Esempio n. 15
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         SafeDispose.DisposeRef(ref _content);
     }
     base.Dispose(disposing);
 }
Esempio n. 16
0
 /// <summary>
 /// Releases resources associated with the object.
 /// </summary>
 /// <param name="disposing">true if the object is being disposed; false if the object is being finalized.</param>
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.DisposeRef(ref content);
     }
     base.Dispose(disposing);
 }
Esempio n. 17
0
 /// <inheritdoc/>
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.Dispose(screen);
     }
     base.Dispose(disposing);
 }
Esempio n. 18
0
 /// <summary>
 /// Invalidates the cached state objects.
 /// </summary>
 private static void InvalidateCache()
 {
     SafeDispose.DisposeRef(ref cachedPointClamp);
     SafeDispose.DisposeRef(ref cachedPointWrap);
     SafeDispose.DisposeRef(ref cachedLinearClamp);
     SafeDispose.DisposeRef(ref cachedLinearWrap);
     SafeDispose.DisposeRef(ref cachedAnisotropicClamp);
     SafeDispose.DisposeRef(ref cachedAnisotropicWrap);
 }
Esempio n. 19
0
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.Dispose(spriteBatch);
         SafeDispose.Dispose(content);
     }
     base.Dispose(disposing);
 }
Esempio n. 20
0
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.Dispose(songPlayer);
         SafeDispose.Dispose(contentManager);
     }
     base.Dispose(disposing);
 }
 /// <inheritdoc/>
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.Dispose(compositor);
     }
     SDL.DestroyWindow(ptr);
     base.Dispose(disposing);
 }
Esempio n. 22
0
        /// <inheritdoc/>
        protected override void Dispose(Boolean disposing)
        {
            if (disposing && !Ultraviolet.Disposed)
            {
                SafeDispose.DisposeRef(ref pool);
            }

            base.Dispose(disposing);
        }
Esempio n. 23
0
 /// <inheritdoc/>
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.Dispose(this.view);
         SafeDispose.Dispose(this.localContent);
     }
     base.Dispose(disposing);
 }
Esempio n. 24
0
 /// <summary>
 /// Releases resources associated with the object.
 /// </summary>
 /// <param name="disposing">true if the object is being disposed; false if the object is being finalized.</param>
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.DisposeRef(ref screenService);
         SafeDispose.DisposeRef(ref globalStyleSheet);
         SafeDispose.DisposeRef(ref content);
     }
     base.Dispose(disposing);
 }
Esempio n. 25
0
        public void DisposeCalled()
        {
            bool        disposeCalled = false;
            IDisposable myDisposable  = DisposableFactory.CreateDisposable(
                () => disposeCalled = true);

            SafeDispose.DisposeAndSetNull(ref myDisposable);

            Assert.True(disposeCalled);
        }
        /// <inheritdoc/>
        protected sealed override void OnUltravioletRun()
        {
            Run();

            SafeDispose.DisposeRef(ref uv);
            if (finished)
            {
                Finish();
            }
        }
Esempio n. 27
0
        /// <inheritdoc/>
        protected override void Dispose(Boolean disposing)
        {
            if (disposing)
            {
                SafeDispose.Dispose(spriteBatch);
                SafeDispose.Dispose(renderTargetPool);

                registeredElements.Clear();
            }
            base.Dispose(disposing);
        }
Esempio n. 28
0
 /// <inheritdoc/>
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         SafeDispose.Dispose(renderTarget);
         SafeDispose.Dispose(colorBuffer);
         SafeDispose.Dispose(depthBuffer);
         SafeDispose.Dispose(stencilBuffer);
     }
     base.Dispose(disposing);
 }
Esempio n. 29
0
        /// <inheritdoc/>
        protected override void Dispose(Boolean disposing)
        {
            if (disposing && !Ultraviolet.Disposed)
            {
                Ultraviolet.GetUI().Updating -= StoryboardClockPool_Updating;

                SafeDispose.DisposeRef(ref pool);
            }

            base.Dispose(disposing);
        }
Esempio n. 30
0
 /// <inheritdoc/>
 protected override void Dispose(Boolean disposing)
 {
     if (disposing)
     {
         foreach (var device in devices)
         {
             SafeDispose.Dispose(device);
         }
     }
     base.Dispose(disposing);
 }