split py files
[android/external-libkmsxx.git] / libkmstest / extcpuframebuffer.cpp
2 #include "extcpuframebuffer.h"
3 #include "test.h"
5 using namespace std;
7 namespace kms
8 {
10 ExtCPUFramebuffer::ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format,
11                                      uint8_t* buffer, uint32_t pitch)
12         : m_width(width), m_height(height), m_format(format)
13 {
14         const PixelFormatInfo& format_info = get_pixel_format_info(m_format);
16         m_num_planes = format_info.num_planes;
18         ASSERT(m_num_planes == 1);
20         const PixelFormatPlaneInfo& pi = format_info.planes[0];
21         FramebufferPlane& plane = m_planes[0];
23         plane.stride = pitch;
24         plane.size = plane.stride * height / pi.ysub;
25         plane.map = buffer;
26 }
28 ExtCPUFramebuffer::ExtCPUFramebuffer(uint32_t width, uint32_t height, PixelFormat format,
29                                      uint8_t* buffers[4], uint32_t pitches[4])
30         : m_width(width), m_height(height), m_format(format)
31 {
32         const PixelFormatInfo& format_info = get_pixel_format_info(m_format);
34         m_num_planes = format_info.num_planes;
36         for (unsigned i = 0; i < format_info.num_planes; ++i) {
37                 const PixelFormatPlaneInfo& pi = format_info.planes[i];
38                 FramebufferPlane& plane = m_planes[i];
40                 plane.stride = pitches[i];
41                 plane.size = plane.stride * height / pi.ysub;
42                 plane.map = buffers[i];
43         }
44 }
46 ExtCPUFramebuffer::~ExtCPUFramebuffer()
47 {
48 }
50 }