OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 "GLContext.h" |
10 #import <OpenGLES/EAGL.h> | 10 #import <OpenGLES/EAGL.h> |
11 #include <dlfcn.h> | 11 #include <dlfcn.h> |
12 | 12 |
13 #define EAGLCTX ((EAGLContext*)(fEAGLContext)) | 13 #define EAGLCTX ((EAGLContext*)(fEAGLContext)) |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 class IOSGLContext : public SkGLContext { | 17 class IOSGLContext : public sk_gpu_test::GLContext { |
18 public: | 18 public: |
19 IOSGLContext(); | 19 IOSGLContext(); |
20 ~IOSGLContext() override; | 20 ~IOSGLContext() override; |
21 | 21 |
22 private: | 22 private: |
23 void destroyGLContext(); | 23 void destroyGLContext(); |
24 | 24 |
25 void onPlatformMakeCurrent() const override; | 25 void onPlatformMakeCurrent() const override; |
26 void onPlatformSwapBuffers() const override; | 26 void onPlatformSwapBuffers() const override; |
27 GrGLFuncPtr onPlatformGetProcAddress(const char*) const override; | 27 GrGLFuncPtr onPlatformGetProcAddress(const char*) const override; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 SkDebugf("Could not set the context.\n"); | 80 SkDebugf("Could not set the context.\n"); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 void IOSGLContext::onPlatformSwapBuffers() const { } | 84 void IOSGLContext::onPlatformSwapBuffers() const { } |
85 | 85 |
86 GrGLFuncPtr IOSGLContext::onPlatformGetProcAddress(const char* procName) const { | 86 GrGLFuncPtr IOSGLContext::onPlatformGetProcAddress(const char* procName) const { |
87 return reinterpret_cast<GrGLFuncPtr>(dlsym(fGLLibrary, procName)); | 87 return reinterpret_cast<GrGLFuncPtr>(dlsym(fGLLibrary, procName)); |
88 } | 88 } |
89 | 89 |
90 } // anonymous namespace | 90 } // anonymous namespace |
91 | 91 |
92 SkGLContext* SkCreatePlatformGLContext(GrGLStandard forcedGpuAPI, SkGLContext* s
hareContext) { | 92 namespace sk_gpu_test { |
| 93 GLContext *CreatePlatformGLContext(GrGLStandard forcedGpuAPI, GLContext *shareCo
ntext) { |
93 SkASSERT(!shareContext); | 94 SkASSERT(!shareContext); |
94 if (shareContext) { | 95 if (shareContext) { |
95 return NULL; | 96 return NULL; |
96 } | 97 } |
97 if (kGL_GrGLStandard == forcedGpuAPI) { | 98 if (kGL_GrGLStandard == forcedGpuAPI) { |
98 return NULL; | 99 return NULL; |
99 } | 100 } |
100 IOSGLContext* ctx = new IOSGLContext; | 101 IOSGLContext *ctx = new IOSGLContext; |
101 if (!ctx->isValid()) { | 102 if (!ctx->isValid()) { |
102 delete ctx; | 103 delete ctx; |
103 return NULL; | 104 return NULL; |
104 } | 105 } |
105 return ctx; | 106 return ctx; |
106 } | 107 } |
| 108 } |
OLD | NEW |