-
Notifications
You must be signed in to change notification settings - Fork 0
/
PixelArrayLegs.h
47 lines (37 loc) · 1.23 KB
/
PixelArrayLegs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include "PixelArray.h"
#include <cmath>
class CPixelArrayLegs : public CPixelArray
{
public:
static constexpr size_t c_alloc_qty = 32;
public:
CPixelArrayLegs(const char* name, CPixelArray::Config* config); // owner
CPixelArrayLegs(const char* name,
CPixelArrayLegs* pixels,
size_t len,
size_t offset = 0,
size_t num_legs=0,
size_t leg_offset=0); // reference to external pixels
virtual ~CPixelArrayLegs();
public:
size_t NumLegs() const { return m_num_legs; }
CPixelArray* GetLeg(size_t index) { return m_legs[index]; }
public:
virtual void ExitRoutine();
virtual void Continue();
private:
size_t m_num_legs = 0;
CPixelArray* m_legs[c_max_num_legs] = {};
private:
static CMemoryPool<CPixelArrayLegs, c_alloc_qty> s_pool;
public:
void* operator new(size_t size)
{
return s_pool.alloc();
}
void operator delete(void* ptr)
{
s_pool.free(reinterpret_cast<CPixelArrayLegs*>(ptr));
}
};