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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkTemplates.h ('k') | include/gpu/gl/GrGLFunctions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« 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