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

Side by Side Diff: include/gpu/gl/GrGLExtensions.h

Issue 140823003: Move GrGLExtensions from GrGLContextInfo to GrGLInterface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix Android Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkTemplates.h ('k') | include/gpu/gl/GrGLFunctions.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 2013 Google Inc. 2 * Copyright 2013 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 GrGLExtensions_DEFINED 8 #ifndef GrGLExtensions_DEFINED
9 #define GrGLExtensions_DEFINED 9 #define GrGLExtensions_DEFINED
10 10
11 #include "GrGLInterface.h" 11 #include "GrGLFunctions.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 #include "SkTArray.h" 13 #include "SkTArray.h"
14 14
15 struct GrGLInterface;
16
15 /** 17 /**
16 * This helper queries the current GL context for its extensions, remembers them , and can be 18 * This helper queries the current GL context for its extensions, remembers them , and can be
17 * queried. It supports both glGetString- and glGetStringi-style extension strin g APIs and will 19 * queried. It supports both glGetString- and glGetStringi-style extension strin g APIs and will
18 * use the latter if it is available. 20 * use the latter if it is available.
19 */ 21 */
20 class GrGLExtensions { 22 class GrGLExtensions : public SkNoncopyable {
21 public: 23 public:
22 bool init(const GrGLInterface* iface) { 24
23 return this->init(iface->fStandard, 25 GrGLExtensions() : fInitialized(false), fStrings(SkNEW(SkTArray<SkString>)) {}
24 iface->fGetString, 26
25 iface->fGetStringi, 27 void swap(GrGLExtensions* that) {
26 iface->fGetIntegerv); 28 fStrings.swap(&that->fStrings);
27 } 29 }
30
28 /** 31 /**
29 * We sometimes need to use this class without having yet created a GrGLInte rface. This version 32 * We sometimes need to use this class without having yet created a GrGLInte rface. This version
30 * of init expects that getString is always non-NULL while getIntegerv and g etStringi are non- 33 * of init expects that getString is always non-NULL while getIntegerv and g etStringi are non-
31 * NULL if on desktop GL with version 3.0 or higher. Otherwise it will fail. 34 * NULL if on desktop GL with version 3.0 or higher. Otherwise it will fail.
32 */ 35 */
33 bool init(GrGLStandard standard, 36 bool init(GrGLStandard standard,
34 GrGLGetStringProc getString, 37 GrGLGetStringProc getString,
35 GrGLGetStringiProc getStringi, 38 GrGLGetStringiProc getStringi,
36 GrGLGetIntegervProc getIntegerv); 39 GrGLGetIntegervProc getIntegerv);
37 40
41 bool isInitialized() const { return fInitialized; }
42
38 /** 43 /**
39 * Queries whether an extension is present. This will fail if init() has not been called. 44 * Queries whether an extension is present. This will fail if init() has not been called.
40 */ 45 */
41 bool has(const char*) const; 46 bool has(const char*) const;
42 47
43 void reset() { fStrings.reset(); } 48 void reset() { fStrings->reset(); }
44 49
45 void print(const char* sep = "\n") const; 50 void print(const char* sep = "\n") const;
46 51
47 private: 52 private:
48 SkTArray<SkString> fStrings; 53 bool fInitialized;
54 SkAutoTDelete<SkTArray<SkString> > fStrings;
49 }; 55 };
50 56
51 #endif 57 #endif
OLDNEW
« no previous file with comments | « include/core/SkTemplates.h ('k') | include/gpu/gl/GrGLFunctions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698