File tree Expand file tree Collapse file tree
src/ImageSharp/Formats/Webp/Lossless Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,33 +8,21 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless;
88
99internal class Vp8LBackwardRefs : IDisposable
1010{
11- private readonly IMemoryOwner < PixOrCopy > owner ;
12- private readonly MemoryHandle handle ;
11+ private readonly IMemoryOwner < PixOrCopy > refs ;
1312 private int count ;
1413
1514 public Vp8LBackwardRefs ( MemoryAllocator memoryAllocator , int pixels )
1615 {
17- this . owner = memoryAllocator . Allocate < PixOrCopy > ( pixels ) ;
18- this . handle = this . owner . Memory . Pin ( ) ;
16+ this . refs = memoryAllocator . Allocate < PixOrCopy > ( pixels ) ;
1917 this . count = 0 ;
2018 }
2119
22- public void Add ( PixOrCopy pixOrCopy )
23- {
24- unsafe
25- {
26- ( ( PixOrCopy * ) this . handle . Pointer ) [ this . count ++ ] = pixOrCopy ;
27- }
28- }
20+ public void Add ( PixOrCopy pixOrCopy ) => this . refs . Memory . Span [ this . count ++ ] = pixOrCopy ;
2921
3022 public void Clear ( ) => this . count = 0 ;
3123
32- public Span < PixOrCopy > . Enumerator GetEnumerator ( ) => this . owner . Slice ( 0 , this . count ) . GetEnumerator ( ) ;
24+ public Span < PixOrCopy > . Enumerator GetEnumerator ( ) => this . refs . Slice ( 0 , this . count ) . GetEnumerator ( ) ;
3325
3426 /// <inheritdoc/>
35- public void Dispose ( )
36- {
37- this . handle . Dispose ( ) ;
38- this . owner . Dispose ( ) ;
39- }
27+ public void Dispose ( ) => this . refs . Dispose ( ) ;
4028}
You can’t perform that action at this time.
0 commit comments