2020-12-23 21:58:36 -05:00
|
|
|
|
namespace ARMeilleure.Common
|
2020-03-18 07:44:32 -04:00
|
|
|
|
{
|
|
|
|
|
static class BitMapPool
|
|
|
|
|
{
|
|
|
|
|
public static BitMap Allocate(int initialCapacity)
|
|
|
|
|
{
|
2021-02-21 21:23:48 -05:00
|
|
|
|
return BitMap().Reset(initialCapacity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region "ThreadStaticPool"
|
|
|
|
|
public static void PrepareBitMapPool(int groupId = 0)
|
|
|
|
|
{
|
|
|
|
|
ThreadStaticPool<BitMap>.PreparePool(groupId, ChunkSizeLimit.Small);
|
|
|
|
|
}
|
2020-12-23 21:58:36 -05:00
|
|
|
|
|
2021-02-21 21:23:48 -05:00
|
|
|
|
private static BitMap BitMap()
|
|
|
|
|
{
|
|
|
|
|
return ThreadStaticPool<BitMap>.Instance.Allocate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ResetBitMapPool(int groupId = 0)
|
|
|
|
|
{
|
|
|
|
|
ThreadStaticPool<BitMap>.ResetPool(groupId);
|
2020-03-18 07:44:32 -04:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-21 21:23:48 -05:00
|
|
|
|
public static void DisposeBitMapPools()
|
2020-03-18 07:44:32 -04:00
|
|
|
|
{
|
2021-02-21 21:23:48 -05:00
|
|
|
|
ThreadStaticPool<BitMap>.DisposePools();
|
2020-03-18 07:44:32 -04:00
|
|
|
|
}
|
2021-02-21 21:23:48 -05:00
|
|
|
|
#endregion
|
2020-03-18 07:44:32 -04:00
|
|
|
|
}
|
|
|
|
|
}
|