OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #ifndef WindowContext_DEFINED | 7 #ifndef WindowContext_DEFINED |
8 #define WindowContext_DEFINED | 8 #define WindowContext_DEFINED |
9 | 9 |
10 #include "DisplayParams.h" | 10 #include "DisplayParams.h" |
11 #include "GrTypes.h" | 11 #include "GrTypes.h" |
| 12 #include "SkRefCnt.h" |
| 13 #include "SkSurfaceProps.h" |
12 | 14 |
| 15 class GrContext; |
13 class SkSurface; | 16 class SkSurface; |
14 | 17 |
15 namespace sk_app { | 18 namespace sk_app { |
16 | 19 |
17 // TODO: fill this out with an interface | |
18 class WindowContext { | 20 class WindowContext { |
19 public: | 21 public: |
| 22 WindowContext() : fContext(nullptr) |
| 23 , fSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType) {} |
| 24 |
20 virtual ~WindowContext() {} | 25 virtual ~WindowContext() {} |
21 | 26 |
22 virtual SkSurface* getBackbufferSurface() = 0; | 27 virtual sk_sp<SkSurface> getBackbufferSurface() = 0; |
23 | 28 |
24 virtual void swapBuffers() = 0; | 29 virtual void swapBuffers() = 0; |
25 | 30 |
26 virtual bool makeCurrent() = 0; | |
27 | |
28 virtual bool isValid() = 0; | 31 virtual bool isValid() = 0; |
29 | 32 |
30 virtual void resize(uint32_t w, uint32_t h) = 0; | 33 virtual void resize(uint32_t w, uint32_t h) = 0; |
31 | 34 |
32 virtual const DisplayParams& getDisplayParams() = 0; | 35 virtual const DisplayParams& getDisplayParams() = 0; |
33 virtual void setDisplayParams(const DisplayParams& params) = 0; | 36 virtual void setDisplayParams(const DisplayParams& params) = 0; |
34 | 37 |
35 virtual GrBackendContext getBackendContext() = 0; | 38 virtual GrBackendContext getBackendContext() = 0; |
| 39 |
| 40 protected: |
| 41 GrContext* fContext; |
| 42 |
| 43 DisplayParams fDisplayParams; |
| 44 GrPixelConfig fPixelConfig; |
| 45 SkSurfaceProps fSurfaceProps; |
36 }; | 46 }; |
37 | 47 |
38 } // namespace sk_app | 48 } // namespace sk_app |
39 | 49 |
40 #endif | 50 #endif |
OLD | NEW |