Esempio n. 1
0
            public override void Dispose()
            {
                if (_innerHandle is null)
                {
                    return;
                }

                Debug.Assert(_parent != null);
                Span <TDestination> destinationSpan = _innerHandle.GetSpan();

                if (_useInplaceConvert)
                {
                    Span <TSource> sourceSpan = MemoryMarshal.Cast <TDestination, TSource>(destinationSpan);
                    _parent !.Convert(sourceSpan, destinationSpan);
                }
                else
                {
                    Span <TSource> sourceSpan = MemoryMarshal.Cast <byte, TSource>(_buffer.AsSpan(0, _length * Unsafe.SizeOf <TSource>()));
                    _parent !.Convert(sourceSpan, destinationSpan);
                }

                _innerHandle.Dispose();
                TiffPixelConverter <TSource, TDestination> parent = _parent;

                _parent      = null;
                _innerHandle = null;
                if (Interlocked.CompareExchange(ref parent._cachedHandle, this, null) != null)
                {
                    ReleaseBuffer();
                }
            }
 public override void Dispose()
 {
     _innerHandle?.Dispose();
     _innerHandle = null;
     if (_parent != null)
     {
         TiffPassthroughPixelBufferWriter <TSource, TDestination> parent = _parent;
         _parent = null;
         Interlocked.CompareExchange(ref parent._cachedHandle, this, null);
     }
 }