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