1
2 #include <kms++util/kms++util.h>
3
4 using namespace std;
5
6 namespace kms
7 {
8
ExtCPUFramebuffer(uint32_t width,uint32_t height,PixelFormat format,uint8_t * buffer,uint32_t size,uint32_t pitch,uint32_t offset)9 ExtCPUFramebuffer::ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format,
10 uint8_t* buffer, uint32_t size, uint32_t pitch, uint32_t offset)
11 : m_width(width), m_height(height), m_format(format)
12 {
13 const PixelFormatInfo& format_info = get_pixel_format_info(m_format);
14
15 m_num_planes = format_info.num_planes;
16
17 ASSERT(m_num_planes == 1);
18
19 FramebufferPlane& plane = m_planes[0];
20
21 plane.stride = pitch;
22 plane.size = size;
23 plane.offset = offset;
24 plane.map = buffer;
25 }
26
ExtCPUFramebuffer(uint32_t width,uint32_t height,PixelFormat format,uint8_t * buffers[4],uint32_t sizes[4],uint32_t pitches[4],uint32_t offsets[4])27 ExtCPUFramebuffer::ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format,
28 uint8_t* buffers[4], uint32_t sizes[4], uint32_t pitches[4], uint32_t offsets[4])
29 : m_width(width), m_height(height), m_format(format)
30 {
31 const PixelFormatInfo& format_info = get_pixel_format_info(m_format);
32
33 m_num_planes = format_info.num_planes;
34
35 for (unsigned i = 0; i < format_info.num_planes; ++i) {
36 FramebufferPlane& plane = m_planes[i];
37
38 plane.stride = pitches[i];
39 plane.size = sizes[i];
40 plane.offset = offsets[i];
41 plane.map = buffers[i];
42 }
43 }
44
~ExtCPUFramebuffer()45 ExtCPUFramebuffer::~ExtCPUFramebuffer()
46 {
47 }
48
49 }
50