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

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

Issue 1153813002: Remove init from GrGLContextInfo and caps classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 years, 7 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
Index: src/gpu/gl/GrGLContext.h
diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h
index 7f46522af290cc681697402b6d18c758bf7667a3..e84c8ecffc265cc0ab651b6a0da2da69f8e3a500 100644
--- a/src/gpu/gl/GrGLContext.h
+++ b/src/gpu/gl/GrGLContext.h
@@ -21,30 +21,8 @@
* Encapsulates information about an OpenGL context including the OpenGL
* version, the GrGLStandard type of the context, and GLSL version.
*/
-class GrGLContextInfo {
+class GrGLContextInfo : public SkNoncopyable {
public:
- /**
- * Default constructor
- */
- GrGLContextInfo() {
- fGLCaps.reset(SkNEW(GrGLCaps));
- this->reset();
- }
-
- GrGLContextInfo(const GrGLContextInfo& that) {
- fGLCaps.reset(SkNEW(GrGLCaps));
- *this = that;
- }
-
- GrGLContextInfo& operator= (const GrGLContextInfo&);
-
- /**
- * Initializes a GrGLContextInfo from a GrGLInterface and the currently
- * bound OpenGL context accessible by the GrGLInterface.
- */
- bool initialize(const GrGLInterface* interface);
- bool isInitialized() const;
-
GrGLStandard standard() const { return fInterface->fStandard; }
GrGLVersion version() const { return fGLVersion; }
GrGLSLGeneration glslGeneration() const { return fGLSLGeneration; }
@@ -59,20 +37,24 @@ public:
const GrGLCaps* caps() const { return fGLCaps.get(); }
GrGLCaps* caps() { return fGLCaps; }
bool hasExtension(const char* ext) const {
- if (!this->isInitialized()) {
- return false;
- }
return fInterface->hasExtension(ext);
}
const GrGLExtensions& extensions() const { return fInterface->fExtensions; }
- /**
- * Reset the information
- */
- void reset();
-
protected:
+ struct ConstructorArgs {
+ const GrGLInterface* fInterface;
+ GrGLVersion fGLVersion;
+ GrGLSLGeneration fGLSLGeneration;
+ GrGLVendor fVendor;
+ GrGLRenderer fRenderer;
+ bool fIsMesa;
+ bool fIsChromium;
+ };
+
+ GrGLContextInfo(const ConstructorArgs& args);
+
SkAutoTUnref<const GrGLInterface> fInterface;
GrGLVersion fGLVersion;
GrGLSLGeneration fGLSLGeneration;
@@ -92,20 +74,13 @@ public:
* Creates a GrGLContext from a GrGLInterface and the currently
* bound OpenGL context accessible by the GrGLInterface.
*/
- explicit GrGLContext(const GrGLInterface* interface) {
- this->initialize(interface);
- }
-
- GrGLContext(const GrGLContext& that) : INHERITED(that) {}
+ static GrGLContext* Create(const GrGLInterface* interface);
- GrGLContext& operator= (const GrGLContext& that) {
- this->INHERITED::operator=(that);
- return *this;
- }
-
- const GrGLInterface* interface() const { return fInterface.get(); }
+ const GrGLInterface* interface() const { return fInterface; }
private:
+ GrGLContext(const ConstructorArgs& args) : INHERITED(args) {}
+
typedef GrGLContextInfo INHERITED;
};

Powered by Google App Engine
This is Rietveld 408576698