| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrContextFactory_DEFINED | 8 #ifndef GrContextFactory_DEFINED |
| 9 #define GrContextFactory_DEFINED | 9 #define GrContextFactory_DEFINED |
| 10 | 10 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * Get a GrContext initialized with a type of GL context. It also makes the
GL context current. | 113 * Get a GrContext initialized with a type of GL context. It also makes the
GL context current. |
| 114 */ | 114 */ |
| 115 GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLSta
ndard); | 115 GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLSta
ndard); |
| 116 | 116 |
| 117 | 117 |
| 118 // Returns the GLContext of the given type. If it has not been created yet, | 118 // Returns the GLContext of the given type. If it has not been created yet, |
| 119 // NULL is returned instead. | 119 // nullptr is returned instead. |
| 120 SkGLContext* getGLContext(GLContextType type) { | 120 SkGLContext* getGLContext(GLContextType type) { |
| 121 for (int i = 0; i < fContexts.count(); ++i) { | 121 for (int i = 0; i < fContexts.count(); ++i) { |
| 122 if (fContexts[i].fType == type) { | 122 if (fContexts[i].fType == type) { |
| 123 return fContexts[i].fGLContext; | 123 return fContexts[i].fGLContext; |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 | 126 |
| 127 return NULL; | 127 return nullptr; |
| 128 } | 128 } |
| 129 | 129 |
| 130 const GrContextOptions& getGlobalOptions() const { return fGlobalOptions; } | 130 const GrContextOptions& getGlobalOptions() const { return fGlobalOptions; } |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 struct GPUContext { | 133 struct GPUContext { |
| 134 GLContextType fType; | 134 GLContextType fType; |
| 135 SkGLContext* fGLContext; | 135 SkGLContext* fGLContext; |
| 136 GrContext* fGrContext; | 136 GrContext* fGrContext; |
| 137 }; | 137 }; |
| 138 SkTArray<GPUContext, true> fContexts; | 138 SkTArray<GPUContext, true> fContexts; |
| 139 const GrContextOptions fGlobalOptions; | 139 const GrContextOptions fGlobalOptions; |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 #endif | 142 #endif |
| OLD | NEW |