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