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

Side by Side Diff: src/gpu/GrClipMaskCache.h

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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 | « src/gpu/GrBufferedDrawTarget.cpp ('k') | src/gpu/GrClipMaskManager.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 2012 Google Inc. 2 * Copyright 2012 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 GrClipMaskCache_DEFINED 8 #ifndef GrClipMaskCache_DEFINED
9 #define GrClipMaskCache_DEFINED 9 #define GrClipMaskCache_DEFINED
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return SkClipStack::kInvalidGenID; 85 return SkClipStack::kInvalidGenID;
86 } 86 }
87 87
88 return ((GrClipStackFrame*) fStack.back())->fLastClipGenID; 88 return ((GrClipStackFrame*) fStack.back())->fLastClipGenID;
89 } 89 }
90 90
91 GrTexture* getLastMask() { 91 GrTexture* getLastMask() {
92 92
93 if (fStack.empty()) { 93 if (fStack.empty()) {
94 SkASSERT(false); 94 SkASSERT(false);
95 return NULL; 95 return nullptr;
96 } 96 }
97 97
98 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); 98 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
99 99
100 return back->fLastMask; 100 return back->fLastMask;
101 } 101 }
102 102
103 const GrTexture* getLastMask() const { 103 const GrTexture* getLastMask() const {
104 104
105 if (fStack.empty()) { 105 if (fStack.empty()) {
106 SkASSERT(false); 106 SkASSERT(false);
107 return NULL; 107 return nullptr;
108 } 108 }
109 109
110 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); 110 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
111 111
112 return back->fLastMask; 112 return back->fLastMask;
113 } 113 }
114 114
115 void acquireMask(int32_t clipGenID, 115 void acquireMask(int32_t clipGenID,
116 const GrSurfaceDesc& desc, 116 const GrSurfaceDesc& desc,
117 const SkIRect& bound) { 117 const SkIRect& bound) {
(...skipping 10 matching lines...) Expand all
128 128
129 int getLastMaskWidth() const { 129 int getLastMaskWidth() const {
130 130
131 if (fStack.empty()) { 131 if (fStack.empty()) {
132 SkASSERT(false); 132 SkASSERT(false);
133 return -1; 133 return -1;
134 } 134 }
135 135
136 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); 136 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
137 137
138 if (NULL == back->fLastMask) { 138 if (nullptr == back->fLastMask) {
139 return -1; 139 return -1;
140 } 140 }
141 141
142 return back->fLastMask->width(); 142 return back->fLastMask->width();
143 } 143 }
144 144
145 int getLastMaskHeight() const { 145 int getLastMaskHeight() const {
146 146
147 if (fStack.empty()) { 147 if (fStack.empty()) {
148 SkASSERT(false); 148 SkASSERT(false);
149 return -1; 149 return -1;
150 } 150 }
151 151
152 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); 152 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
153 153
154 if (NULL == back->fLastMask) { 154 if (nullptr == back->fLastMask) {
155 return -1; 155 return -1;
156 } 156 }
157 157
158 return back->fLastMask->height(); 158 return back->fLastMask->height();
159 } 159 }
160 160
161 void getLastBound(SkIRect* bound) const { 161 void getLastBound(SkIRect* bound) const {
162 162
163 if (fStack.empty()) { 163 if (fStack.empty()) {
164 SkASSERT(false); 164 SkASSERT(false);
165 bound->setEmpty(); 165 bound->setEmpty();
166 return; 166 return;
167 } 167 }
168 168
169 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); 169 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
170 170
171 *bound = back->fLastBound; 171 *bound = back->fLastBound;
172 } 172 }
173 173
174 // TODO: Remove this when we hold cache keys instead of refs to textures. 174 // TODO: Remove this when we hold cache keys instead of refs to textures.
175 void purgeResources() { 175 void purgeResources() {
176 SkDeque::F2BIter iter(fStack); 176 SkDeque::F2BIter iter(fStack);
177 for (GrClipStackFrame* frame = (GrClipStackFrame*) iter.next(); 177 for (GrClipStackFrame* frame = (GrClipStackFrame*) iter.next();
178 frame != NULL; 178 frame != nullptr;
179 frame = (GrClipStackFrame*) iter.next()) { 179 frame = (GrClipStackFrame*) iter.next()) {
180 frame->reset(); 180 frame->reset();
181 } 181 }
182 } 182 }
183 183
184 private: 184 private:
185 struct GrClipStackFrame { 185 struct GrClipStackFrame {
186 186
187 GrClipStackFrame() { 187 GrClipStackFrame() {
188 this->reset(); 188 this->reset();
(...skipping 12 matching lines...) Expand all
201 fLastMask.reset(resourceProvider->createApproxTexture(desc, kFlags)) ; 201 fLastMask.reset(resourceProvider->createApproxTexture(desc, kFlags)) ;
202 202
203 fLastBound = bound; 203 fLastBound = bound;
204 } 204 }
205 205
206 void reset () { 206 void reset () {
207 fLastClipGenID = SkClipStack::kInvalidGenID; 207 fLastClipGenID = SkClipStack::kInvalidGenID;
208 208
209 GrSurfaceDesc desc; 209 GrSurfaceDesc desc;
210 210
211 fLastMask.reset(NULL); 211 fLastMask.reset(nullptr);
212 fLastBound.setEmpty(); 212 fLastBound.setEmpty();
213 } 213 }
214 214
215 int32_t fLastClipGenID; 215 int32_t fLastClipGenID;
216 // The mask's width & height values are used by GrClipMaskManager to cor rectly scale the 216 // The mask's width & height values are used by GrClipMaskManager to cor rectly scale the
217 // texture coords for the geometry drawn with this mask. TODO: This shou ld be a cache key 217 // texture coords for the geometry drawn with this mask. TODO: This shou ld be a cache key
218 // and not a hard ref to a texture. 218 // and not a hard ref to a texture.
219 SkAutoTUnref<GrTexture> fLastMask; 219 SkAutoTUnref<GrTexture> fLastMask;
220 // fLastBound stores the bounding box of the clip mask in clip-stack spa ce. This rect is 220 // fLastBound stores the bounding box of the clip mask in clip-stack spa ce. This rect is
221 // used by GrClipMaskManager to position a rect and compute texture coor ds for the mask. 221 // used by GrClipMaskManager to position a rect and compute texture coor ds for the mask.
222 SkIRect fLastBound; 222 SkIRect fLastBound;
223 }; 223 };
224 224
225 SkDeque fStack; 225 SkDeque fStack;
226 GrResourceProvider* fResourceProvider; 226 GrResourceProvider* fResourceProvider;
227 227
228 typedef SkNoncopyable INHERITED; 228 typedef SkNoncopyable INHERITED;
229 }; 229 };
230 230
231 #endif // GrClipMaskCache_DEFINED 231 #endif // GrClipMaskCache_DEFINED
OLDNEW
« no previous file with comments | « src/gpu/GrBufferedDrawTarget.cpp ('k') | src/gpu/GrClipMaskManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698