Ejemplo n.º 1
0
 /// <summary>
 /// Disposes of any resources held by the <see cref="DrawingContext"/>.
 /// </summary>
 public void Dispose()
 {
     while (_states.Count != 0)
     {
         _states.Peek().Dispose();
     }
     StateStackPool.Return(_states);
     _states = null;
     if (_transformContainers.Count != 0)
     {
         throw new InvalidOperationException("Transform container stack is non-empty");
     }
     TransformStackPool.Return(_transformContainers);
     _transformContainers = null;
     if (_ownsImpl)
     {
         PlatformImpl.Dispose();
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Disposes of any resources held by the <see cref="DrawingContext"/>.
 /// </summary>
 public void Dispose()
 {
     if (_states is null || _transformContainers is null)
     {
         throw new ObjectDisposedException(nameof(DrawingContext));
     }
     while (_states.Count != 0)
     {
         _states.Peek().Dispose();
     }
     StateStackPool.Return(_states);
     _states = null;
     if (_transformContainers.Count != 0)
     {
         throw new InvalidOperationException("Transform container stack is non-empty");
     }
     TransformStackPool.Return(_transformContainers);
     _transformContainers = null;
     if (_ownsImpl)
     {
         PlatformImpl.Dispose();
     }
 }