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