OSDN Git Service

Store the native display as an opaque pointer.
[android-x86/external-swiftshader.git] / src / Main / FrameBufferAndroid.hpp
1 #ifndef sw_FrameBufferAndroid_hpp
2 #define sw_FrameBufferAndroid_hpp
3
4 #include "Main/FrameBuffer.hpp"
5 #include "Common/Debug.hpp"
6
7 #include <hardware/gralloc.h>
8 #include <system/window.h>
9
10 namespace sw
11 {
12     class FrameBufferAndroid : public FrameBuffer
13     {
14     public:
15         FrameBufferAndroid(ANativeWindow* window, int width, int height);
16
17         ~FrameBufferAndroid();
18
19         void flip(void *source, Format sourceFormat, size_t sourceStride) override {blit(source, 0, 0, sourceFormat, sourceStride);};
20                 void blit(void *source, const Rect *sourceRect, const Rect *destRect, Format sourceFormat, size_t sourceStride) override;
21
22                 void *lock() override;
23                 void unlock() override;
24
25         bool setSwapRectangle(int l, int t, int w, int h);
26
27     private:
28         ANativeWindow* nativeWindow;
29         ANativeWindowBuffer* buffer;
30         gralloc_module_t const* gralloc;
31     };
32 }
33
34 #endif   // sw_FrameBufferAndroid