OLD | NEW |
| (Empty) |
1 | |
2 /* | |
3 * Copyright 2015 Google Inc. | |
4 * | |
5 * Use of this source code is governed by a BSD-style license that can be | |
6 * found in the LICENSE file. | |
7 */ | |
8 #ifndef SKCOMMANDBUFFERGLCONTEXT_DEFINED | |
9 #define SKCOMMANDBUFFERGLCONTEXT_DEFINED | |
10 | |
11 #if SK_COMMAND_BUFFER | |
12 | |
13 #include "gl/SkGLContext.h" | |
14 | |
15 class SkCommandBufferGLContext : public SkGLContext { | |
16 public: | |
17 ~SkCommandBufferGLContext() override; | |
18 | |
19 static SkCommandBufferGLContext* Create() { | |
20 SkCommandBufferGLContext* ctx = new SkCommandBufferGLContext; | |
21 if (!ctx->isValid()) { | |
22 delete ctx; | |
23 return nullptr; | |
24 } | |
25 return ctx; | |
26 } | |
27 | |
28 static SkCommandBufferGLContext* Create(void* nativeWindow, int msaaSampleCo
unt) { | |
29 SkCommandBufferGLContext* ctx = new SkCommandBufferGLContext(nativeWindo
w, | |
30 msaaSampleC
ount); | |
31 if (!ctx->isValid()) { | |
32 delete ctx; | |
33 return nullptr; | |
34 } | |
35 return ctx; | |
36 } | |
37 | |
38 void presentCommandBuffer(); | |
39 | |
40 bool makeCurrent(); | |
41 int getStencilBits(); | |
42 int getSampleCount(); | |
43 | |
44 private: | |
45 SkCommandBufferGLContext(); | |
46 SkCommandBufferGLContext(void* nativeWindow, int msaaSampleCount); | |
47 void initializeGLContext(void* nativeWindow, const int* configAttribs, | |
48 const int* surfaceAttribs); | |
49 void destroyGLContext(); | |
50 | |
51 void onPlatformMakeCurrent() const override; | |
52 void onPlatformSwapBuffers() const override; | |
53 GrGLFuncPtr onPlatformGetProcAddress(const char* name) const override; | |
54 | |
55 void* fContext; | |
56 void* fDisplay; | |
57 void* fSurface; | |
58 void* fConfig; | |
59 }; | |
60 | |
61 #endif // SK_COMMAND_BUFFER | |
62 | |
63 #endif | |
OLD | NEW |