1 #pragma once
3 #include "kms++.h"
5 namespace kms
6 {
8 class ExtCPUFramebuffer : public IMappedFramebuffer
9 {
10 public:
11 ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format,
12 uint8_t* buffer, uint32_t pitch);
13 ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format,
14 uint8_t* buffers[4], uint32_t pitches[4]);
15 virtual ~ExtCPUFramebuffer();
17 uint32_t width() const { return m_width; }
18 uint32_t height() const { return m_height; }
20 PixelFormat format() const { return m_format; }
21 unsigned num_planes() const { return m_num_planes; }
23 uint32_t stride(unsigned plane) const { return m_planes[plane].stride; }
24 uint32_t size(unsigned plane) const { return m_planes[plane].size; }
25 uint32_t offset(unsigned plane) const { return 0; }
26 uint8_t* map(unsigned plane) { return m_planes[plane].map; }
28 private:
29 struct FramebufferPlane {
30 uint32_t size;
31 uint32_t stride;
32 uint8_t *map;
33 };
35 uint32_t m_width;
36 uint32_t m_height;
37 PixelFormat m_format;
39 unsigned m_num_planes;
40 struct FramebufferPlane m_planes[4];
41 };
42 }