24 lines
571 B
C++
24 lines
571 B
C++
#pragma once
|
|
#include "../types.hpp"
|
|
|
|
class FrameBuffer {
|
|
public:
|
|
FrameBuffer();
|
|
~FrameBuffer();
|
|
|
|
bool init(const char* device = "/dev/fb0");
|
|
void release();
|
|
int width() const { return _width; }
|
|
int height() const { return _height; }
|
|
uint16* buffer() const { return _buffer; }
|
|
bool write(const uint8* rgb888_data, int w, int h);
|
|
|
|
private:
|
|
int _fd;
|
|
uint16* _buffer;
|
|
int _width;
|
|
int _height;
|
|
int _screensize;
|
|
void _rgb888_to_rgb565(const uint8* src, uint16* dst, int pixels);
|
|
};
|