aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLContext.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-16 18:39:04 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-16 18:39:04 +0000
commitb1854a85095f9924947bc00e665da47b0c0bdfb9 (patch)
tree43f177933917ec14fdb565700189215c4f50a41d /src/gpu/gl/GrGLContext.h
parent5b8bde5db24f581d69b7efce72cf42110b80eaf5 (diff)
Make GrGLContextInfo have private ptr to GrGLInterface
BUG=skia:2042 R=robertphillips@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/140843003 git-svn-id: http://skia.googlecode.com/svn/trunk@13111 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/gl/GrGLContext.h')
-rw-r--r--src/gpu/gl/GrGLContext.h80
1 files changed, 30 insertions, 50 deletions
diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h
index a418121f49..13c94a902d 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