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

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

Issue 1850543003: Revert of rename sk_gpu_test::GLContext to sk_gpu_test::GLTestContext (Closed) Base URL: https://chromium.googlesource.com/skia.git@move
Patch Set: Created 4 years, 8 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 | « tools/VisualBench/VisualStreamTimingModule.cpp ('k') | tools/gpu/GrContextFactory.cpp » ('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
11 #include "GrContext.h" 11 #include "GrContext.h"
12 #include "GrContextOptions.h" 12 #include "GrContextOptions.h"
13 13
14 #include "gl/GLTestContext.h" 14 #include "gl/GLContext.h"
15 #include "SkTArray.h" 15 #include "SkTArray.h"
16 16
17 namespace sk_gpu_test { 17 namespace sk_gpu_test {
18 /** 18 /**
19 * This is a simple class that is useful in test apps that use different 19 * This is a simple class that is useful in test apps that use different
20 * GrContexts backed by different types of GL contexts. It manages creating the 20 * GrContexts backed by different types of GL contexts. It manages creating the
21 * GL context and a GrContext that uses it. The GL/Gr contexts persist until the 21 * GL context and a GrContext that uses it. The GL/Gr contexts persist until the
22 * factory is destroyed (though the caller can always grab a ref on the returned 22 * factory is destroyed (though the caller can always grab a ref on the returned
23 * Gr and GL contexts to make them outlive the factory). 23 * Gr and GL contexts to make them outlive the factory).
24 */ 24 */
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 GrContextFactory(); 104 GrContextFactory();
105 105
106 ~GrContextFactory(); 106 ~GrContextFactory();
107 107
108 void destroyContexts(); 108 void destroyContexts();
109 void abandonContexts(); 109 void abandonContexts();
110 110
111 struct ContextInfo { 111 struct ContextInfo {
112 ContextInfo() 112 ContextInfo()
113 : fGrContext(nullptr), fGLContext(nullptr) { } 113 : fGrContext(nullptr), fGLContext(nullptr) { }
114 ContextInfo(GrContext* grContext, GLTestContext* glContext) 114 ContextInfo(GrContext* grContext, GLContext* glContext)
115 : fGrContext(grContext), fGLContext(glContext) { } 115 : fGrContext(grContext), fGLContext(glContext) { }
116 GrContext* fGrContext; 116 GrContext* fGrContext;
117 GLTestContext* fGLContext; //! Valid until the factory destroys it via a bandonContexts() or 117 GLContext* fGLContext; //! Valid until the factory destroys it via aband onContexts() or
118 //! destroyContexts(). 118 //! destroyContexts().
119 }; 119 };
120 120
121 /** 121 /**
122 * Get a context initialized with a type of GL context. It also makes the GL context current. 122 * Get a context initialized with a type of GL context. It also makes the GL context current.
123 */ 123 */
124 ContextInfo getContextInfo(GLContextType type, 124 ContextInfo getContextInfo(GLContextType type,
125 GLContextOptions options = kNone_GLContextOptions ); 125 GLContextOptions options = kNone_GLContextOptions );
126 /** 126 /**
127 * Get a GrContext initialized with a type of GL context. It also makes the GL context current. 127 * Get a GrContext initialized with a type of GL context. It also makes the GL context current.
128 */ 128 */
129 GrContext* get(GLContextType type, 129 GrContext* get(GLContextType type,
130 GLContextOptions options = kNone_GLContextOptions) { 130 GLContextOptions options = kNone_GLContextOptions) {
131 return this->getContextInfo(type, options).fGrContext; 131 return this->getContextInfo(type, options).fGrContext;
132 } 132 }
133 const GrContextOptions& getGlobalOptions() const { return fGlobalOptions; } 133 const GrContextOptions& getGlobalOptions() const { return fGlobalOptions; }
134 134
135 private: 135 private:
136 struct Context { 136 struct Context {
137 GLContextType fType; 137 GLContextType fType;
138 GLContextOptions fOptions; 138 GLContextOptions fOptions;
139 GLTestContext* fGLContext; 139 GLContext* fGLContext;
140 GrContext* fGrContext; 140 GrContext* fGrContext;
141 }; 141 };
142 SkTArray<Context, true> fContexts; 142 SkTArray<Context, true> fContexts;
143 const GrContextOptions fGlobalOptions; 143 const GrContextOptions fGlobalOptions;
144 }; 144 };
145 } // namespace sk_gpu_test 145 } // namespace sk_gpu_test
146 #endif 146 #endif
OLDNEW
« no previous file with comments | « tools/VisualBench/VisualStreamTimingModule.cpp ('k') | tools/gpu/GrContextFactory.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698