summaryrefslogtreecommitdiffstats
path: root/minui/graphics_fbdev.h
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-11-01 19:37:33 +0100
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-11-01 19:37:33 +0100
commitd2e1c0a981c1069b9a8b3f89d1da560cecdc30da (patch)
treedc0e8b221eeb6154bdc661a68fa2b331ade0ac28 /minui/graphics_fbdev.h
parentMerge "Refactor the code to check the metadata" (diff)
parentminui: Remove the default and copy ctors for GRSurface. (diff)
downloadandroid_bootable_recovery-d2e1c0a981c1069b9a8b3f89d1da560cecdc30da.tar
android_bootable_recovery-d2e1c0a981c1069b9a8b3f89d1da560cecdc30da.tar.gz
android_bootable_recovery-d2e1c0a981c1069b9a8b3f89d1da560cecdc30da.tar.bz2
android_bootable_recovery-d2e1c0a981c1069b9a8b3f89d1da560cecdc30da.tar.lz
android_bootable_recovery-d2e1c0a981c1069b9a8b3f89d1da560cecdc30da.tar.xz
android_bootable_recovery-d2e1c0a981c1069b9a8b3f89d1da560cecdc30da.tar.zst
android_bootable_recovery-d2e1c0a981c1069b9a8b3f89d1da560cecdc30da.zip
Diffstat (limited to 'minui/graphics_fbdev.h')
-rw-r--r--minui/graphics_fbdev.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/minui/graphics_fbdev.h b/minui/graphics_fbdev.h
index be813dccb..934e584d7 100644
--- a/minui/graphics_fbdev.h
+++ b/minui/graphics_fbdev.h
@@ -19,37 +19,50 @@
#include <linux/fb.h>
#include <stdint.h>
+#include <memory>
+#include <vector>
+
#include "graphics.h"
#include "minui/minui.h"
class GRSurfaceFbdev : public GRSurface {
public:
+ // Creates and returns a GRSurfaceFbdev instance, or nullptr on error.
+ static std::unique_ptr<GRSurfaceFbdev> Create(int width, int height, int row_bytes,
+ int pixel_bytes);
+
uint8_t* data() override {
return buffer_;
}
+ protected:
+ using GRSurface::GRSurface;
+
private:
friend class MinuiBackendFbdev;
// Points to the start of the buffer: either the mmap'd framebuffer or one allocated in-memory.
- uint8_t* buffer_;
+ uint8_t* buffer_{ nullptr };
};
class MinuiBackendFbdev : public MinuiBackend {
public:
+ MinuiBackendFbdev() = default;
+ ~MinuiBackendFbdev() override;
+
GRSurface* Init() override;
GRSurface* Flip() override;
void Blank(bool) override;
- ~MinuiBackendFbdev() override;
- MinuiBackendFbdev();
private:
- void SetDisplayedFramebuffer(unsigned n);
+ void SetDisplayedFramebuffer(size_t n);
- GRSurfaceFbdev gr_framebuffer[2];
+ std::unique_ptr<GRSurfaceFbdev> gr_framebuffer[2];
+ // Points to the current surface (i.e. one of the two gr_framebuffer's).
+ GRSurfaceFbdev* gr_draw{ nullptr };
bool double_buffered;
- GRSurfaceFbdev* gr_draw;
- int displayed_buffer;
+ std::vector<uint8_t> memory_buffer;
+ size_t displayed_buffer{ 0 };
fb_var_screeninfo vi;
- int fb_fd;
+ int fb_fd{ -1 };
};