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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 } | 99 } |
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) { |
robertphillips
2014/07/29 14:32:31
NULL != ?
bsalomon
2014/07/29 14:43:15
Done.
| |
110 SkSafeSetNull(fContexts[i].fGLContext); | 110 if (fContexts[i].fGLContext) { |
111 fContexts[i].fGLContext->testAbandon(); | |
robertphillips
2014/07/29 14:32:31
SkSafeSetNull(fContexts[i].fGLContext); ?
bsalomon
2014/07/29 14:43:15
Done.
| |
112 fContexts[i].fGLContext->unref(); | |
113 fContexts[i].fGLContext = NULL; | |
114 } | |
111 fContexts[i].fGrContext->abandonContext(); | 115 fContexts[i].fGrContext->abandonContext(); |
112 } | 116 } |
113 } | 117 } |
114 | 118 |
115 /** | 119 /** |
116 * Get a GrContext initialized with a type of GL context. It also makes the GL context current. | 120 * Get a GrContext initialized with a type of GL context. It also makes the GL context current. |
117 */ | 121 */ |
118 GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLSta ndard) { | 122 GrContext* get(GLContextType type, GrGLStandard forcedGpuAPI = kNone_GrGLSta ndard) { |
119 for (int i = 0; i < fContexts.count(); ++i) { | 123 for (int i = 0; i < fContexts.count(); ++i) { |
120 if (forcedGpuAPI != kNone_GrGLStandard && | 124 if (forcedGpuAPI != kNone_GrGLStandard && |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 private: | 205 private: |
202 struct GPUContext { | 206 struct GPUContext { |
203 GLContextType fType; | 207 GLContextType fType; |
204 SkGLContextHelper* fGLContext; | 208 SkGLContextHelper* fGLContext; |
205 GrContext* fGrContext; | 209 GrContext* fGrContext; |
206 }; | 210 }; |
207 SkTArray<GPUContext, true> fContexts; | 211 SkTArray<GPUContext, true> fContexts; |
208 }; | 212 }; |
209 | 213 |
210 #endif | 214 #endif |
OLD | NEW |