Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: include/gpu/GrContextFactory.h

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/GrContext.h ('k') | include/gpu/GrCoordTransform.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 } 89 }
90 90
91 explicit GrContextFactory(const GrContext::Options& opts) : fGlobalOptions(o pts) { } 91 explicit GrContextFactory(const GrContext::Options& opts) : fGlobalOptions(o pts) { }
92 GrContextFactory() { } 92 GrContextFactory() { }
93 93
94 ~GrContextFactory() { this->destroyContexts(); } 94 ~GrContextFactory() { this->destroyContexts(); }
95 95
96 void destroyContexts() { 96 void destroyContexts() {
97 for (int i = 0; i < fContexts.count(); ++i) { 97 for (int i = 0; i < fContexts.count(); ++i) {
98 if (NULL != fContexts[i].fGLContext) { // could be abandoned. 98 if (fContexts[i].fGLContext) { // could be abandoned.
99 fContexts[i].fGLContext->makeCurrent(); 99 fContexts[i].fGLContext->makeCurrent();
100 } 100 }
101 fContexts[i].fGrContext->unref(); 101 fContexts[i].fGrContext->unref();
102 if (NULL != fContexts[i].fGLContext) { 102 if (fContexts[i].fGLContext) {
103 fContexts[i].fGLContext->unref(); 103 fContexts[i].fGLContext->unref();
104 } 104 }
105 } 105 }
106 fContexts.reset(); 106 fContexts.reset();
107 } 107 }
108 108
109 void abandonContexts() { 109 void abandonContexts() {
110 for (int i = 0; i < fContexts.count(); ++i) { 110 for (int i = 0; i < fContexts.count(); ++i) {
111 if (NULL != fContexts[i].fGLContext) { 111 if (fContexts[i].fGLContext) {
112 fContexts[i].fGLContext->testAbandon(); 112 fContexts[i].fGLContext->testAbandon();
113 SkSafeSetNull(fContexts[i].fGLContext); 113 SkSafeSetNull(fContexts[i].fGLContext);
114 } 114 }
115 fContexts[i].fGrContext->abandonContext(); 115 fContexts[i].fGrContext->abandonContext();
116 } 116 }
117 } 117 }
118 118
119 /** 119 /**
120 * 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.
121 */ 121 */
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 struct GPUContext { 208 struct GPUContext {
209 GLContextType fType; 209 GLContextType fType;
210 SkGLContextHelper* fGLContext; 210 SkGLContextHelper* fGLContext;
211 GrContext* fGrContext; 211 GrContext* fGrContext;
212 }; 212 };
213 SkTArray<GPUContext, true> fContexts; 213 SkTArray<GPUContext, true> fContexts;
214 const GrContext::Options fGlobalOptions; 214 const GrContext::Options fGlobalOptions;
215 }; 215 };
216 216
217 #endif 217 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | include/gpu/GrCoordTransform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698