aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2017-02-07 14:51:00 -0600
committerTao Bao2017-02-10 19:05:15 -0600
commit557fa1f45e413777a31b1bb2db4eee826c3ee486 (patch)
treeeb142b80610f473197e284f372784c25f04a4f3b /minui/graphics.h
parentdf464dbe79202b62f8b2cf73f45e52d9f32e5e5e (diff)
downloadplatform-bootable-recovery-557fa1f45e413777a31b1bb2db4eee826c3ee486.tar.gz
platform-bootable-recovery-557fa1f45e413777a31b1bb2db4eee826c3ee486.tar.xz
platform-bootable-recovery-557fa1f45e413777a31b1bb2db4eee826c3ee486.zip
minui: Move graphics_{adf,drm,fbdev} into classes.
This CL defines minui_backend as an interface, and expresses the three backends (adf, drm and fbdev) as subclasses to the interface. Test: 'Run graphics test' on N9, Pixel C and N5X. Change-Id: I0e23951c7b2e2ff918957a8d9fc8b0085b6e5952
Diffstat (limited to 'minui/graphics.h')
-rw-r--r--minui/graphics.h29
1 files changed, 12 insertions, 17 deletions
diff --git a/minui/graphics.h b/minui/graphics.h
index 1eaafc75..3c45a406 100644
--- a/minui/graphics.h
+++ b/minui/graphics.h
@@ -19,25 +19,20 @@
19 19
20#include "minui/minui.h" 20#include "minui/minui.h"
21 21
22// TODO: lose the function pointers. 22class MinuiBackend {
23struct minui_backend { 23 public:
24 // Initializes the backend and returns a GRSurface* to draw into. 24 // Initializes the backend and returns a GRSurface* to draw into.
25 GRSurface* (*init)(minui_backend*); 25 virtual GRSurface* Init() = 0;
26 26
27 // Causes the current drawing surface (returned by the most recent 27 // Causes the current drawing surface (returned by the most recent call to Flip() or Init()) to
28 // call to flip() or init()) to be displayed, and returns a new 28 // be displayed, and returns a new drawing surface.
29 // drawing surface. 29 virtual GRSurface* Flip() = 0;
30 GRSurface* (*flip)(minui_backend*);
31 30
32 // Blank (or unblank) the screen. 31 // Blank (or unblank) the screen.
33 void (*blank)(minui_backend*, bool); 32 virtual void Blank(bool) = 0;
34 33
35 // Device cleanup when drawing is done. 34 // Device cleanup when drawing is done.
36 void (*exit)(minui_backend*); 35 virtual ~MinuiBackend() {};
37}; 36};
38 37
39minui_backend* open_fbdev(); 38#endif // _GRAPHICS_H_
40minui_backend* open_adf();
41minui_backend* open_drm();
42
43#endif