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