File tree Expand file tree Collapse file tree 1 file changed +5
-17
lines changed
src/ImageSharp/Formats/Webp/Lossless Expand file tree Collapse file tree 1 file changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -8,33 +8,21 @@ namespace SixLabors.ImageSharp.Formats.Webp.Lossless;
8
8
9
9
internal class Vp8LBackwardRefs : IDisposable
10
10
{
11
- private readonly IMemoryOwner < PixOrCopy > owner ;
12
- private readonly MemoryHandle handle ;
11
+ private readonly IMemoryOwner < PixOrCopy > refs ;
13
12
private int count ;
14
13
15
14
public Vp8LBackwardRefs ( MemoryAllocator memoryAllocator , int pixels )
16
15
{
17
- this . owner = memoryAllocator . Allocate < PixOrCopy > ( pixels ) ;
18
- this . handle = this . owner . Memory . Pin ( ) ;
16
+ this . refs = memoryAllocator . Allocate < PixOrCopy > ( pixels ) ;
19
17
this . count = 0 ;
20
18
}
21
19
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 ;
29
21
30
22
public void Clear ( ) => this . count = 0 ;
31
23
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 ( ) ;
33
25
34
26
/// <inheritdoc/>
35
- public void Dispose ( )
36
- {
37
- this . handle . Dispose ( ) ;
38
- this . owner . Dispose ( ) ;
39
- }
27
+ public void Dispose ( ) => this . refs . Dispose ( ) ;
40
28
}
You can’t perform that action at this time.
0 commit comments