| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 fContexts[i].fGrContext->unref(); | 100 fContexts[i].fGrContext->unref(); |
| 101 if (NULL != fContexts[i].fGLContext) { | 101 if (NULL != fContexts[i].fGLContext) { |
| 102 fContexts[i].fGLContext->unref(); | 102 fContexts[i].fGLContext->unref(); |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 fContexts.reset(); | 105 fContexts.reset(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void abandonContexts() { | 108 void abandonContexts() { |
| 109 for (int i = 0; i < fContexts.count(); ++i) { | 109 for (int i = 0; i < fContexts.count(); ++i) { |
| 110 SkSafeSetNull(fContexts[i].fGLContext); | 110 if (NULL != fContexts[i].fGLContext) { |
| 111 fContexts[i].fGLContext->testAbandon(); |
| 112 SkSafeSetNull(fContexts[i].fGLContext); |
| 113 } |
| 111 fContexts[i].fGrContext->abandonContext(); | 114 fContexts[i].fGrContext->abandonContext(); |
| 112 } | 115 } |
| 113 } | 116 } |
| 114 | 117 |
| 115 /** | 118 /** |
| 116 * Get a GrContext initialized with a type of GL context. It also makes the
GL context current. | 119 * Get a GrContext initialized with a type of GL context. It also makes the
GL context current. |
| 117 */ | 120 */ |
| 118 GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLSta
ndard) { | 121 GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLSta
ndard) { |
| 119 for (int i = 0; i < fContexts.count(); ++i) { | 122 for (int i = 0; i < fContexts.count(); ++i) { |
| 120 if (forcedGpuAPI != kNone_GrGLStandard && | 123 if (forcedGpuAPI != kNone_GrGLStandard && |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 private: | 204 private: |
| 202 struct GPUContext { | 205 struct GPUContext { |
| 203 GLContextType fType; | 206 GLContextType fType; |
| 204 SkGLContextHelper* fGLContext; | 207 SkGLContextHelper* fGLContext; |
| 205 GrContext* fGrContext; | 208 GrContext* fGrContext; |
| 206 }; | 209 }; |
| 207 SkTArray<GPUContext, true> fContexts; | 210 SkTArray<GPUContext, true> fContexts; |
| 208 }; | 211 }; |
| 209 | 212 |
| 210 #endif | 213 #endif |
| OLD | NEW |