Make GrDrawTarget::Caps ref counted and GrGLCaps derive from it.
Also rename GrDrawTarget::getCaps() -> GrDrawTarget::caps().
Review URL: https://codereview.chromium.org/12843026
git-svn-id: http://skia.googlecode.com/svn/trunk@8364 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h
index 1091ab9..71b3861 100644
--- a/src/gpu/gl/GrGLContext.h
+++ b/src/gpu/gl/GrGLContext.h
@@ -26,7 +26,10 @@
/**
* Default constructor
*/
- GrGLContextInfo() { this->reset(); }
+ GrGLContextInfo() {
+ fGLCaps.reset(SkNEW(GrGLCaps));
+ this->reset();
+ }
/**
* Copies a GrGLContextInfo
@@ -44,8 +47,8 @@
GrGLVersion version() const { return fGLVersion; }
GrGLSLGeneration glslGeneration() const { return fGLSLGeneration; }
GrGLVendor vendor() const { return fVendor; }
- const GrGLCaps& caps() const { return fGLCaps; }
- GrGLCaps& caps() { return fGLCaps; }
+ const GrGLCaps* caps() const { return fGLCaps.get(); }
+ GrGLCaps* caps() { return fGLCaps; }
/**
* Checks for extension support using a cached copy of the GL_EXTENSIONS
@@ -65,12 +68,12 @@
private:
- GrGLBinding fBindingInUse;
- GrGLVersion fGLVersion;
- GrGLSLGeneration fGLSLGeneration;
- GrGLVendor fVendor;
- GrGLExtensions fExtensions;
- GrGLCaps fGLCaps;
+ GrGLBinding fBindingInUse;
+ GrGLVersion fGLVersion;
+ GrGLSLGeneration fGLSLGeneration;
+ GrGLVendor fVendor;
+ GrGLExtensions fExtensions;
+ SkAutoTUnref<GrGLCaps> fGLCaps;
};
/**