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

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

Issue 1966013002: Turn ContextInfos returned by GrContextFactory into structs. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Address comment Created 4 years, 7 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 | « tests/skbug5221.cpp ('k') | tools/kilobench/kilobench.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/GLTestContext.h"
15 #include "SkTArray.h" 15 #include "SkTArray.h"
16 16
17 struct GrVkBackendContext; 17 struct GrVkBackendContext;
18 18
19 namespace sk_gpu_test { 19 namespace sk_gpu_test {
20 20
21 struct ContextInfo { 21 class ContextInfo {
22 public:
23 GrContext* grContext() const { return fGrContext; }
24 GLTestContext* glContext() const { return fGLContext; }
25
26 private:
22 ContextInfo() 27 ContextInfo()
23 : fGrContext(nullptr), fGLContext(nullptr) { } 28 : fGrContext(nullptr), fGLContext(nullptr) { }
24 ContextInfo(GrContext* grContext, GLTestContext* glContext) 29 ContextInfo(GrContext* grContext, GLTestContext* glContext)
25 : fGrContext(grContext), fGLContext(glContext) { } 30 : fGrContext(grContext), fGLContext(glContext) { }
26 GrContext* fGrContext; 31 GrContext* fGrContext;
27 GLTestContext* fGLContext; //! Valid until the factory destroys it via aband onContexts() or 32 GLTestContext* fGLContext; //! Valid until the factory destroys it via aband onContexts() or
28 //! destroyContexts(). Null if context is not bas ed on OpenGL. 33 //! destroyContexts(). Null if context is not bas ed on OpenGL.
34
35 friend class GrContextFactory;
29 }; 36 };
30 37
31 /** 38 /**
32 * This is a simple class that is useful in test apps that use different 39 * This is a simple class that is useful in test apps that use different
33 * GrContexts backed by different types of GL contexts. It manages creating the 40 * GrContexts backed by different types of GL contexts. It manages creating the
34 * GL context and a GrContext that uses it. The GL/Gr contexts persist until the 41 * GL context and a GrContext that uses it. The GL/Gr contexts persist until the
35 * factory is destroyed (though the caller can always grab a ref on the returned 42 * factory is destroyed (though the caller can always grab a ref on the returned
36 * Gr and GL contexts to make them outlive the factory). 43 * Gr and GL contexts to make them outlive the factory).
37 */ 44 */
38 class GrContextFactory : SkNoncopyable { 45 class GrContextFactory : SkNoncopyable {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 GLTestContext* fGLContext; // null if non-GL 145 GLTestContext* fGLContext; // null if non-GL
139 GrContext* fGrContext; 146 GrContext* fGrContext;
140 bool fAbandoned; 147 bool fAbandoned;
141 }; 148 };
142 SkTArray<Context, true> fContexts; 149 SkTArray<Context, true> fContexts;
143 SkAutoTDelete<GLTestContext> fSentinelGLContext; 150 SkAutoTDelete<GLTestContext> fSentinelGLContext;
144 const GrContextOptions fGlobalOptions; 151 const GrContextOptions fGlobalOptions;
145 }; 152 };
146 } // namespace sk_gpu_test 153 } // namespace sk_gpu_test
147 #endif 154 #endif
OLDNEW
« no previous file with comments | « tests/skbug5221.cpp ('k') | tools/kilobench/kilobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698