|
|
@ -8,7 +8,7 @@ namespace Avalonia.Media.TextFormatting |
|
|
public sealed class ShapedBuffer : IList<GlyphInfo>, IDisposable |
|
|
public sealed class ShapedBuffer : IList<GlyphInfo>, IDisposable |
|
|
{ |
|
|
{ |
|
|
private static readonly IComparer<GlyphInfo> s_clusterComparer = new CompareClusters(); |
|
|
private static readonly IComparer<GlyphInfo> s_clusterComparer = new CompareClusters(); |
|
|
private bool _rented; |
|
|
private bool _bufferRented; |
|
|
|
|
|
|
|
|
public ShapedBuffer(CharacterBufferRange characterBufferRange, int bufferLength, IGlyphTypeface glyphTypeface, double fontRenderingEmSize, sbyte bidiLevel) : |
|
|
public ShapedBuffer(CharacterBufferRange characterBufferRange, int bufferLength, IGlyphTypeface glyphTypeface, double fontRenderingEmSize, sbyte bidiLevel) : |
|
|
this(characterBufferRange, |
|
|
this(characterBufferRange, |
|
|
@ -17,7 +17,7 @@ namespace Avalonia.Media.TextFormatting |
|
|
fontRenderingEmSize, |
|
|
fontRenderingEmSize, |
|
|
bidiLevel) |
|
|
bidiLevel) |
|
|
{ |
|
|
{ |
|
|
_rented = true; |
|
|
_bufferRented = true; |
|
|
Length = bufferLength; |
|
|
Length = bufferLength; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -272,7 +272,7 @@ namespace Avalonia.Media.TextFormatting |
|
|
public void Dispose() |
|
|
public void Dispose() |
|
|
{ |
|
|
{ |
|
|
GC.SuppressFinalize(this); |
|
|
GC.SuppressFinalize(this); |
|
|
if (_rented) |
|
|
if (_bufferRented) |
|
|
{ |
|
|
{ |
|
|
GlyphInfos.ReturnRent(); |
|
|
GlyphInfos.ReturnRent(); |
|
|
} |
|
|
} |
|
|
@ -280,7 +280,7 @@ namespace Avalonia.Media.TextFormatting |
|
|
|
|
|
|
|
|
~ShapedBuffer() |
|
|
~ShapedBuffer() |
|
|
{ |
|
|
{ |
|
|
if (_rented) |
|
|
if (_bufferRented) |
|
|
{ |
|
|
{ |
|
|
GlyphInfos.ReturnRent(); |
|
|
GlyphInfos.ReturnRent(); |
|
|
} |
|
|
} |
|
|
|