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 |