OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef GrDebugGL_DEFINED | 9 #ifndef GrDebugGL_DEFINED |
10 #define GrDebugGL_DEFINED | 10 #define GrDebugGL_DEFINED |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 void setUnPackRowLength(GrGLint unPackRowLength) { | 86 void setUnPackRowLength(GrGLint unPackRowLength) { |
87 fUnPackRowLength = unPackRowLength; | 87 fUnPackRowLength = unPackRowLength; |
88 } | 88 } |
89 GrGLint getUnPackRowLength() const { return fUnPackRowLength; } | 89 GrGLint getUnPackRowLength() const { return fUnPackRowLength; } |
90 | 90 |
91 static GrDebugGL *getInstance() { | 91 static GrDebugGL *getInstance() { |
92 // someone should admit to actually using this class | 92 // someone should admit to actually using this class |
93 SkASSERT(0 < gStaticRefCount); | 93 SkASSERT(0 < gStaticRefCount); |
94 | 94 |
95 if (NULL == gObj) { | 95 if (nullptr == gObj) { |
96 gObj = new GrDebugGL; | 96 gObj = new GrDebugGL; |
97 } | 97 } |
98 | 98 |
99 return gObj; | 99 return gObj; |
100 } | 100 } |
101 | 101 |
102 void report() const; | 102 void report() const; |
103 | 103 |
104 static void staticRef() { | 104 static void staticRef() { |
105 gStaticRefCount++; | 105 gStaticRefCount++; |
106 } | 106 } |
107 | 107 |
108 static void staticUnRef() { | 108 static void staticUnRef() { |
109 SkASSERT(gStaticRefCount > 0); | 109 SkASSERT(gStaticRefCount > 0); |
110 gStaticRefCount--; | 110 gStaticRefCount--; |
111 if (0 == gStaticRefCount) { | 111 if (0 == gStaticRefCount) { |
112 delete gObj; | 112 delete gObj; |
113 gObj = NULL; | 113 gObj = nullptr; |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 static void abandon() { | 117 static void abandon() { |
118 SkASSERT(gStaticRefCount > 0); | 118 SkASSERT(gStaticRefCount > 0); |
119 gObj->fAbandoned = true; | 119 gObj->fAbandoned = true; |
120 } | 120 } |
121 | 121 |
122 protected: | 122 protected: |
123 | 123 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // type) easier | 158 // type) easier |
159 #define GR_CREATE(className, classEnum) \ | 159 #define GR_CREATE(className, classEnum) \ |
160 reinterpret_cast<className *>(GrDebugGL::getInstance()->createObj(classEnum)
) | 160 reinterpret_cast<className *>(GrDebugGL::getInstance()->createObj(classEnum)
) |
161 | 161 |
162 //////////////////////////////////////////////////////////////////////////////// | 162 //////////////////////////////////////////////////////////////////////////////// |
163 // Helper macro to make finding objects less painful | 163 // Helper macro to make finding objects less painful |
164 #define GR_FIND(id, className, classEnum) \ | 164 #define GR_FIND(id, className, classEnum) \ |
165 reinterpret_cast<className *>(GrDebugGL::getInstance()->findObject(id, class
Enum)) | 165 reinterpret_cast<className *>(GrDebugGL::getInstance()->findObject(id, class
Enum)) |
166 | 166 |
167 #endif // GrDebugGL_DEFINED | 167 #endif // GrDebugGL_DEFINED |
OLD | NEW |