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

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

Issue 545253002: Change behavior of GrDS::AutoEffectRestort wrt GPs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove extra period 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 | « src/gpu/GrDrawState.h ('k') | no next file » | 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 #include "GrDrawState.h" 8 #include "GrDrawState.h"
9 #include "GrPaint.h" 9 #include "GrPaint.h"
10 #include "GrDrawTargetCaps.h" 10 #include "GrDrawTargetCaps.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 fVAPtr = drawState->fVAPtr; 292 fVAPtr = drawState->fVAPtr;
293 fVACount = drawState->fVACount; 293 fVACount = drawState->fVACount;
294 fVAStride = drawState->fVAStride; 294 fVAStride = drawState->fVAStride;
295 fDrawState->setDefaultVertexAttribs(); 295 fDrawState->setDefaultVertexAttribs();
296 } 296 }
297 297
298 //////////////////////////////////////////////////////////////////////////////s 298 //////////////////////////////////////////////////////////////////////////////s
299 299
300 void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) { 300 void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) {
301 if (NULL != fDrawState) { 301 if (NULL != fDrawState) {
302 fDrawState->fGeometryProcessor.reset(fGeometryProcessor.detach()); 302 // See the big comment on the class definition about GPs.
303 if (NULL != fOriginalGP) {
304 SkASSERT(fDrawState->getGeometryProcessor()->getEffect() == fOrigina lGP);
305 fOriginalGP->unref();
306 fOriginalGP = NULL;
307 } else {
308 fDrawState->fGeometryProcessor.reset(NULL);
309 }
303 310
304 int m = fDrawState->numColorStages() - fColorEffectCnt; 311 int m = fDrawState->numColorStages() - fColorEffectCnt;
305 SkASSERT(m >= 0); 312 SkASSERT(m >= 0);
306 fDrawState->fColorStages.pop_back_n(m); 313 fDrawState->fColorStages.pop_back_n(m);
307 314
308 int n = fDrawState->numCoverageStages() - fCoverageEffectCnt; 315 int n = fDrawState->numCoverageStages() - fCoverageEffectCnt;
309 SkASSERT(n >= 0); 316 SkASSERT(n >= 0);
310 fDrawState->fCoverageStages.pop_back_n(n); 317 fDrawState->fCoverageStages.pop_back_n(n);
311 if (m + n > 0) { 318 if (m + n > 0) {
312 fDrawState->invalidateBlendOptFlags(); 319 fDrawState->invalidateBlendOptFlags();
313 } 320 }
314 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) 321 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;)
315 } 322 }
316 fDrawState = ds; 323 fDrawState = ds;
317 if (NULL != ds) { 324 if (NULL != ds) {
318 if (ds->hasGeometryProcessor()) { 325 SkASSERT(NULL == fOriginalGP);
319 fGeometryProcessor.reset(SkNEW_ARGS(GrEffectStage, (*ds->getGeometry Processor()))); 326 if (NULL != ds->getGeometryProcessor()) {
320 } else { 327 fOriginalGP = SkRef(ds->getGeometryProcessor()->getEffect());
321 fGeometryProcessor.reset(NULL);
322 } 328 }
323 fColorEffectCnt = ds->numColorStages(); 329 fColorEffectCnt = ds->numColorStages();
324 fCoverageEffectCnt = ds->numCoverageStages(); 330 fCoverageEffectCnt = ds->numCoverageStages();
325 SkDEBUGCODE(++ds->fBlockEffectRemovalCnt;) 331 SkDEBUGCODE(++ds->fBlockEffectRemovalCnt;)
326 } 332 }
327 } 333 }
328 334
329 //////////////////////////////////////////////////////////////////////////////// 335 ////////////////////////////////////////////////////////////////////////////////
330 336
331 GrRODrawState::BlendOptFlags GrDrawState::getBlendOpts(bool forceCoverage, 337 GrRODrawState::BlendOptFlags GrDrawState::getBlendOpts(bool forceCoverage,
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 //////////////////////////////////////////////////////////////////////////////// 603 ////////////////////////////////////////////////////////////////////////////////
598 604
599 bool GrDrawState::canIgnoreColorAttribute() const { 605 bool GrDrawState::canIgnoreColorAttribute() const {
600 if (fBlendOptFlags & kInvalid_BlendOptFlag) { 606 if (fBlendOptFlags & kInvalid_BlendOptFlag) {
601 this->getBlendOpts(); 607 this->getBlendOpts();
602 } 608 }
603 return SkToBool(fBlendOptFlags & (GrRODrawState::kEmitTransBlack_BlendOptFla g | 609 return SkToBool(fBlendOptFlags & (GrRODrawState::kEmitTransBlack_BlendOptFla g |
604 GrRODrawState::kEmitCoverage_BlendOptFlag) ); 610 GrRODrawState::kEmitCoverage_BlendOptFlag) );
605 } 611 }
606 612
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698