OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 #include "gl/SkGLContext.h" | 9 #include "gl/GLContext.h" |
10 | 10 |
11 #include <windows.h> | 11 #include <windows.h> |
12 #include <GL/GL.h> | 12 #include <GL/GL.h> |
13 #include "win/SkWGL.h" | 13 #include "win/SkWGL.h" |
14 | 14 |
15 #define WIN32_LEAN_AND_MEAN | 15 #define WIN32_LEAN_AND_MEAN |
16 #include <windows.h> | 16 #include <windows.h> |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 class WinGLContext : public SkGLContext { | 20 class WinGLContext : public sk_gpu_test::GLContext { |
21 public: | 21 public: |
22 WinGLContext(GrGLStandard forcedGpuAPI); | 22 WinGLContext(GrGLStandard forcedGpuAPI); |
23 ~WinGLContext() override; | 23 ~WinGLContext() override; |
24 | 24 |
25 private: | 25 private: |
26 void destroyGLContext(); | 26 void destroyGLContext(); |
27 | 27 |
28 void onPlatformMakeCurrent() const override; | 28 void onPlatformMakeCurrent() const override; |
29 void onPlatformSwapBuffers() const override; | 29 void onPlatformSwapBuffers() const override; |
30 GrGLFuncPtr onPlatformGetProcAddress(const char* name) const override; | 30 GrGLFuncPtr onPlatformGetProcAddress(const char* name) const override; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 SkDebugf("Could not complete SwapBuffers.\n"); | 180 SkDebugf("Could not complete SwapBuffers.\n"); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 GrGLFuncPtr WinGLContext::onPlatformGetProcAddress(const char* name) const { | 184 GrGLFuncPtr WinGLContext::onPlatformGetProcAddress(const char* name) const { |
185 return reinterpret_cast<GrGLFuncPtr>(wglGetProcAddress(name)); | 185 return reinterpret_cast<GrGLFuncPtr>(wglGetProcAddress(name)); |
186 } | 186 } |
187 | 187 |
188 } // anonymous namespace | 188 } // anonymous namespace |
189 | 189 |
190 SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI, SkGLContext* s
hareContext) { | 190 namespace sk_gpu_test { |
| 191 GLContext* CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareCo
ntext) { |
191 SkASSERT(!shareContext); | 192 SkASSERT(!shareContext); |
192 if (shareContext) { | 193 if (shareContext) { |
193 return nullptr; | 194 return nullptr; |
194 } | 195 } |
195 WinGLContext* ctx = new WinGLContext(forcedGpuAPI); | 196 WinGLContext *ctx = new WinGLContext(forcedGpuAPI); |
196 if (!ctx->isValid()) { | 197 if (!ctx->isValid()) { |
197 delete ctx; | 198 delete ctx; |
198 return nullptr; | 199 return nullptr; |
199 } | 200 } |
200 return ctx; | 201 return ctx; |
201 } | 202 } |
| 203 } // namespace sk_gpu_test |
202 | 204 |
OLD | NEW |