OLD | NEW |
---|---|
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: |
robertphillips
2014/01/16 17:13:11
delete this?
bsalomon
2014/01/16 18:28:45
Done.
| |
24 #if 0 | |
22 bool init(const GrGLInterface* iface) { | 25 bool init(const GrGLInterface* iface) { |
23 return this->init(iface->fStandard, | 26 return this->init(iface->fStandard, |
24 iface->fGetString, | 27 iface->fGetString, |
25 iface->fGetStringi, | 28 iface->fGetStringi, |
26 iface->fGetIntegerv); | 29 iface->fGetIntegerv); |
27 } | 30 } |
31 #endif | |
32 GrGLExtensions() : fStrings(SkNEW(SkTArray<SkString>)), fInitialized(false) {} | |
33 | |
34 void swap(GrGLExtensions* that) { | |
35 fStrings.swap(&that->fStrings); | |
36 } | |
37 | |
28 /** | 38 /** |
29 * We sometimes need to use this class without having yet created a GrGLInte rface. This version | 39 * 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- | 40 * 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. | 41 * NULL if on desktop GL with version 3.0 or higher. Otherwise it will fail. |
32 */ | 42 */ |
33 bool init(GrGLStandard standard, | 43 bool init(GrGLStandard standard, |
34 GrGLGetStringProc getString, | 44 GrGLGetStringProc getString, |
35 GrGLGetStringiProc getStringi, | 45 GrGLGetStringiProc getStringi, |
36 GrGLGetIntegervProc getIntegerv); | 46 GrGLGetIntegervProc getIntegerv); |
37 | 47 |
48 bool isInitialized() const { return fInitialized; } | |
49 | |
38 /** | 50 /** |
39 * Queries whether an extension is present. This will fail if init() has not been called. | 51 * Queries whether an extension is present. This will fail if init() has not been called. |
40 */ | 52 */ |
41 bool has(const char*) const; | 53 bool has(const char*) const; |
42 | 54 |
43 void reset() { fStrings.reset(); } | 55 void reset() { fStrings->reset(); } |
44 | 56 |
45 void print(const char* sep = "\n") const; | 57 void print(const char* sep = "\n") const; |
46 | 58 |
47 private: | 59 private: |
48 SkTArray<SkString> fStrings; | 60 bool fInitialized; |
61 SkAutoTDelete<SkTArray<SkString> > fStrings; | |
49 }; | 62 }; |
50 | 63 |
51 #endif | 64 #endif |
OLD | NEW |