Index: include/gpu/gl/GrGLExtensions.h |
diff --git a/include/gpu/gl/GrGLExtensions.h b/include/gpu/gl/GrGLExtensions.h |
index 45f698ef29dfac0384453c0e4401e31f087d489e..26d2afb7926604bb1f572d8d478f513997060aec 100644 |
--- a/include/gpu/gl/GrGLExtensions.h |
+++ b/include/gpu/gl/GrGLExtensions.h |
@@ -8,23 +8,26 @@ |
#ifndef GrGLExtensions_DEFINED |
#define GrGLExtensions_DEFINED |
-#include "GrGLInterface.h" |
+#include "GrGLFunctions.h" |
#include "SkString.h" |
#include "SkTArray.h" |
+struct GrGLInterface; |
+ |
/** |
* This helper queries the current GL context for its extensions, remembers them, and can be |
* queried. It supports both glGetString- and glGetStringi-style extension string APIs and will |
* use the latter if it is available. |
*/ |
-class GrGLExtensions { |
+class GrGLExtensions : public SkNoncopyable { |
public: |
- bool init(const GrGLInterface* iface) { |
- return this->init(iface->fStandard, |
- iface->fGetString, |
- iface->fGetStringi, |
- iface->fGetIntegerv); |
+ |
+ GrGLExtensions() : fInitialized(false), fStrings(SkNEW(SkTArray<SkString>)) {} |
+ |
+ void swap(GrGLExtensions* that) { |
+ fStrings.swap(&that->fStrings); |
} |
+ |
/** |
* We sometimes need to use this class without having yet created a GrGLInterface. This version |
* of init expects that getString is always non-NULL while getIntegerv and getStringi are non- |
@@ -35,17 +38,20 @@ public: |
GrGLGetStringiProc getStringi, |
GrGLGetIntegervProc getIntegerv); |
+ bool isInitialized() const { return fInitialized; } |
+ |
/** |
* Queries whether an extension is present. This will fail if init() has not been called. |
*/ |
bool has(const char*) const; |
- void reset() { fStrings.reset(); } |
+ void reset() { fStrings->reset(); } |
void print(const char* sep = "\n") const; |
private: |
- SkTArray<SkString> fStrings; |
+ bool fInitialized; |
+ SkAutoTDelete<SkTArray<SkString> > fStrings; |
}; |
#endif |