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

Unified Diff: src/gpu/gl/GrGLContext.h

Issue 140843003: Make GrGLContextInfo have private ptr to GrGLInterface (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tot 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 | « no previous file | src/gpu/gl/GrGLContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLContext.h
diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h
index a418121f49d7b19419f3d24a009a353a7382eae3..13c94a902d7ad5e0742296a3791d382f81cc5db5 100644
--- a/src/gpu/gl/GrGLContext.h
+++ b/src/gpu/gl/GrGLContext.h
@@ -31,10 +31,12 @@ public:
this->reset();
}
- /**
- * Copies a GrGLContextInfo
- */
- GrGLContextInfo& operator= (const GrGLContextInfo& ctxInfo);
+ GrGLContextInfo(const GrGLContextInfo& that) {
+ fGLCaps.reset(SkNEW(GrGLCaps));
+ *this = that;
+ }
+
+ GrGLContextInfo& operator= (const GrGLContextInfo&);
/**
* Initializes a GrGLContextInfo from a GrGLInterface and the currently
@@ -43,7 +45,7 @@ public:
bool initialize(const GrGLInterface* interface);
bool isInitialized() const;
- GrGLStandard standard() const { return fStandard; }
+ GrGLStandard standard() const { return fInterface->fStandard; }
GrGLVersion version() const { return fGLVersion; }
GrGLSLGeneration glslGeneration() const { return fGLSLGeneration; }
GrGLVendor vendor() const { return fVendor; }
@@ -59,7 +61,7 @@ public:
const GrGLExtensions& extensions() const { return fExtensions; }
/**
- * Shortcut for extensions().has(ext);
+ * Shortcut for extensions().has(ext)
*/
bool hasExtension(const char* ext) const {
if (!this->isInitialized()) {
@@ -73,64 +75,42 @@ public:
*/
void reset();
-private:
-
- GrGLStandard fStandard;
- GrGLVersion fGLVersion;
- GrGLSLGeneration fGLSLGeneration;
- GrGLVendor fVendor;
- GrGLRenderer fRenderer;
- GrGLExtensions fExtensions;
- bool fIsMesa;
- bool fIsChromium;
- SkAutoTUnref<GrGLCaps> fGLCaps;
+protected:
+ SkAutoTUnref<const GrGLInterface> fInterface;
+ GrGLVersion fGLVersion;
+ GrGLSLGeneration fGLSLGeneration;
+ GrGLVendor fVendor;
+ GrGLRenderer fRenderer;
+ GrGLExtensions fExtensions;
+ bool fIsMesa;
+ bool fIsChromium;
+ SkAutoTUnref<GrGLCaps> fGLCaps;
};
/**
- * Encapsulates the GrGLInterface used to make GL calls plus information
- * about the context (via GrGLContextInfo).
+ * Extension of GrGLContextInfo that also provides access to GrGLInterface.
*/
-class GrGLContext {
+class GrGLContext : public GrGLContextInfo {
public:
/**
- * Default constructor
- */
- GrGLContext() { this->reset(); }
-
- /**
* Creates a GrGLContext from a GrGLInterface and the currently
* bound OpenGL context accessible by the GrGLInterface.
*/
- explicit GrGLContext(const GrGLInterface* interface);
-
- /**
- * Copies a GrGLContext
- */
- GrGLContext(const GrGLContext& ctx);
-
- ~GrGLContext() { SkSafeUnref(fInterface); }
+ explicit GrGLContext(const GrGLInterface* interface) {
+ this->initialize(interface);
+ }
- /**
- * Copies a GrGLContext
- */
- GrGLContext& operator= (const GrGLContext& ctx);
+ GrGLContext(const GrGLContext& that) : INHERITED(that) {}
- /**
- * Initializes a GrGLContext from a GrGLInterface and the currently
- * bound OpenGL context accessible by the GrGLInterface.
- */
- bool initialize(const GrGLInterface* interface);
- bool isInitialized() const { return fInfo.isInitialized(); }
+ GrGLContext& operator= (const GrGLContext& that) {
+ this->INHERITED::operator=(that);
+ return *this;
+ }
- const GrGLInterface* interface() const { return fInterface; }
- const GrGLContextInfo& info() const { return fInfo; }
- GrGLContextInfo& info() { return fInfo; }
+ const GrGLInterface* interface() const { return fInterface.get(); }
private:
- void reset();
-
- const GrGLInterface* fInterface;
- GrGLContextInfo fInfo;
+ typedef GrGLContextInfo INHERITED;
};
#endif
« no previous file with comments | « no previous file | src/gpu/gl/GrGLContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698