]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/external-libkmsxx.git/blob - libkms++util/cpuframebuffer.h
File/dir renames
[android/external-libkmsxx.git] / libkms++util / cpuframebuffer.h
1 #pragma once
3 #include "kms++.h"
5 namespace kms
6 {
8 class CPUFramebuffer : public IMappedFramebuffer {
9 public:
10         CPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format);
12         virtual ~CPUFramebuffer();
14         CPUFramebuffer(const CPUFramebuffer& other) = delete;
15         CPUFramebuffer& operator=(const CPUFramebuffer& other) = delete;
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 m_planes[plane].offset; }
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                 uint32_t offset;
33                 uint8_t *map;
34         };
36         uint32_t m_width;
37         uint32_t m_height;
38         PixelFormat m_format;
40         unsigned m_num_planes;
41         struct FramebufferPlane m_planes[4];
42 };
44 }