-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPixmap.h
54 lines (44 loc) · 972 Bytes
/
Pixmap.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
48
49
50
51
52
53
54
#pragma once
#include <string>
#include <cstring>
#include <boost/shared_ptr.hpp>
#include "constants.h"
#include "Object.h"
namespace dawn
{
class Buffer
{
public:
Buffer(const void *data, size_t length)
{
m_data = new uint8_t[length];
std::memcpy(m_data, data, length);
m_length = length;
}
virtual ~Buffer()
{
delete [] m_data;
}
const uint8_t *raw() const
{
return m_data;
}
private:
uint8_t *m_data;
size_t m_length;
};
typedef boost::shared_ptr<Buffer> BufferPtr;
class Pixmap : public Object
{
public:
virtual ~Pixmap() { }
virtual bool isChanged(etag_t *etag, bool recursive) {
return Object::isChanged(etag, recursive);
}
virtual CONSTANTS::PixmapType type() const = 0;
virtual BufferPtr buffer() = 0;
virtual unsigned int width() = 0;
virtual unsigned int height() = 0;
virtual CONSTANTS::PixelFormat format() = 0;
};
}