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

Side by Side Diff: include/gpu/gl/GrGLInterface.h

Issue 1666203002: Move Google3-specific stack limitation logic to template classes. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Fix GLPtr(Alias). Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « include/core/SkTypes.h ('k') | include/private/SkTemplates.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrGLInterface_DEFINED 8 #ifndef GrGLInterface_DEFINED
9 #define GrGLInterface_DEFINED 9 #define GrGLInterface_DEFINED
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 * be available based on the OpenGL's version and extension string must be 102 * be available based on the OpenGL's version and extension string must be
103 * non-NULL or GrContext creation will fail. This can be tested with the 103 * non-NULL or GrContext creation will fail. This can be tested with the
104 * validate() method when the OpenGL context has been made current. 104 * validate() method when the OpenGL context has been made current.
105 */ 105 */
106 struct SK_API GrGLInterface : public SkRefCnt { 106 struct SK_API GrGLInterface : public SkRefCnt {
107 private: 107 private:
108 // simple wrapper class that exists only to initialize a pointer to NULL 108 // simple wrapper class that exists only to initialize a pointer to NULL
109 template <typename FNPTR_TYPE> class GLPtr { 109 template <typename FNPTR_TYPE> class GLPtr {
110 public: 110 public:
111 GLPtr() : fPtr(NULL) {} 111 GLPtr() : fPtr(NULL) {}
112 GLPtr operator=(FNPTR_TYPE ptr) { fPtr = ptr; return *this; } 112 GLPtr(const GLPtr&) = delete;
113 GLPtr& operator=(FNPTR_TYPE ptr) { fPtr = ptr; return *this; }
113 operator FNPTR_TYPE() const { return fPtr; } 114 operator FNPTR_TYPE() const { return fPtr; }
114 private: 115 private:
115 FNPTR_TYPE fPtr; 116 FNPTR_TYPE fPtr;
116 }; 117 };
117 118
118 // This is a temporary workaround to keep Chromium's GrGLInterface factories compiling until 119 // This is a temporary workaround to keep Chromium's GrGLInterface factories compiling until
119 // they're updated to use the Functions struct. 120 // they're updated to use the Functions struct.
120 template <typename FNPTR_TYPE> class GLPtrAlias { 121 template <typename FNPTR_TYPE> class GLPtrAlias {
121 public: 122 public:
122 GLPtrAlias(GLPtr<FNPTR_TYPE>* base) : fBase(base) {} 123 explicit GLPtrAlias(GLPtr<FNPTR_TYPE>* base) : fBase(base) {}
124 GLPtrAlias(const GLPtrAlias&) = delete;
123 void operator=(FNPTR_TYPE ptr) { *fBase = ptr; } 125 void operator=(FNPTR_TYPE ptr) { *fBase = ptr; }
124 private: 126 private:
125 GLPtr<FNPTR_TYPE>* fBase; 127 GLPtr<FNPTR_TYPE>* fBase;
126 }; 128 };
127 129
128 typedef SkRefCnt INHERITED; 130 typedef SkRefCnt INHERITED;
129 131
130 public: 132 public:
131 GrGLInterface(); 133 GrGLInterface();
132 134
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 #if GR_GL_PER_GL_FUNC_CALLBACK 508 #if GR_GL_PER_GL_FUNC_CALLBACK
507 GrGLInterfaceCallbackProc fCallback; 509 GrGLInterfaceCallbackProc fCallback;
508 GrGLInterfaceCallbackData fCallbackData; 510 GrGLInterfaceCallbackData fCallbackData;
509 #endif 511 #endif
510 512
511 // This exists for internal testing. 513 // This exists for internal testing.
512 virtual void abandon() const {} 514 virtual void abandon() const {}
513 }; 515 };
514 516
515 #endif 517 #endif
OLDNEW
« no previous file with comments | « include/core/SkTypes.h ('k') | include/private/SkTemplates.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698