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

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

Issue 546043002: Don't take a ref on GP in AutoEffectRestore. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 6 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 | « include/gpu/GrProgramElement.h ('k') | src/gpu/GrDrawState.cpp » ('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 GrDrawState_DEFINED 8 #ifndef GrDrawState_DEFINED
9 #define GrDrawState_DEFINED 9 #define GrDrawState_DEFINED
10 10
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 * significant complexity to the multi-ref architecture for deferred drawing . Once GrDrawState 249 * significant complexity to the multi-ref architecture for deferred drawing . Once GrDrawState
250 * and GrOptDrawState are fully separated then GrDrawState will never be in the deferred 250 * and GrOptDrawState are fully separated then GrDrawState will never be in the deferred
251 * execution state and GrOptDrawState always will be (and will be immutable and therefore 251 * execution state and GrOptDrawState always will be (and will be immutable and therefore
252 * unable to have an ARE). At this point we can restore sanity and have the ARE save and restore 252 * unable to have an ARE). At this point we can restore sanity and have the ARE save and restore
253 * the GP. 253 * the GP.
254 */ 254 */
255 class AutoRestoreEffects : public ::SkNoncopyable { 255 class AutoRestoreEffects : public ::SkNoncopyable {
256 public: 256 public:
257 AutoRestoreEffects() 257 AutoRestoreEffects()
258 : fDrawState(NULL) 258 : fDrawState(NULL)
259 , fOriginalGP(NULL) 259 , fOriginalGPID(SK_InvalidUniqueID)
260 , fColorEffectCnt(0) 260 , fColorEffectCnt(0)
261 , fCoverageEffectCnt(0) {} 261 , fCoverageEffectCnt(0) {}
262 262
263 AutoRestoreEffects(GrDrawState* ds) 263 AutoRestoreEffects(GrDrawState* ds)
264 : fDrawState(NULL) 264 : fDrawState(NULL)
265 , fOriginalGP(NULL) 265 , fOriginalGPID(SK_InvalidUniqueID)
266 , fColorEffectCnt(0) 266 , fColorEffectCnt(0)
267 , fCoverageEffectCnt(0) { 267 , fCoverageEffectCnt(0) {
268 this->set(ds); 268 this->set(ds);
269 } 269 }
270 270
271 ~AutoRestoreEffects() { this->set(NULL); } 271 ~AutoRestoreEffects() { this->set(NULL); }
272 272
273 void set(GrDrawState* ds); 273 void set(GrDrawState* ds);
274 274
275 bool isSet() const { return NULL != fDrawState; } 275 bool isSet() const { return NULL != fDrawState; }
276 276
277 private: 277 private:
278 GrDrawState* fDrawState; 278 GrDrawState* fDrawState;
279 const GrEffect* fOriginalGP; 279 uint32_t fOriginalGPID;
280 int fColorEffectCnt; 280 int fColorEffectCnt;
281 int fCoverageEffectCnt; 281 int fCoverageEffectCnt;
282 }; 282 };
283 283
284 /// @} 284 /// @}
285 285
286 /////////////////////////////////////////////////////////////////////////// 286 ///////////////////////////////////////////////////////////////////////////
287 /// @name Blending 287 /// @name Blending
288 //// 288 ////
289 289
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 // Some of the auto restore objects assume that no effects are removed durin g their lifetime. 564 // Some of the auto restore objects assume that no effects are removed durin g their lifetime.
565 // This is used to assert that this condition holds. 565 // This is used to assert that this condition holds.
566 SkDEBUGCODE(int fBlockEffectRemovalCnt;) 566 SkDEBUGCODE(int fBlockEffectRemovalCnt;)
567 567
568 void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, siz e_t stride); 568 void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, siz e_t stride);
569 569
570 typedef GrRODrawState INHERITED; 570 typedef GrRODrawState INHERITED;
571 }; 571 };
572 572
573 #endif 573 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrProgramElement.h ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698