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

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

Issue 375823005: Remove gpu shader optimatization for solid white or trans black colors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change ignore function name Created 6 years, 5 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') | src/gpu/gl/GrGLProgram.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 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 10
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 if (kOne_GrBlendCoeff == *srcCoeff && 402 if (kOne_GrBlendCoeff == *srcCoeff &&
403 kZero_GrBlendCoeff == *dstCoeff && 403 kZero_GrBlendCoeff == *dstCoeff &&
404 this->willEffectReadDstColor()) { 404 this->willEffectReadDstColor()) {
405 // In this case the shader will fully resolve the color, coverage, and d st and we don't 405 // In this case the shader will fully resolve the color, coverage, and d st and we don't
406 // need blending. 406 // need blending.
407 return kDisableBlend_BlendOptFlag; 407 return kDisableBlend_BlendOptFlag;
408 } 408 }
409 return kNone_BlendOpt; 409 return kNone_BlendOpt;
410 } 410 }
411 411
412 bool GrDrawState::canIgnoreColorAttribute() const {
413 if (fBlendOptFlags & kInvalid_BlendOptFlag) {
414 this->getBlendOpts();
415 }
416 return SkToBool(fBlendOptFlags & (GrDrawState::kEmitTransBlack_BlendOptFlag |
417 GrDrawState::kEmitCoverage_BlendOptFlag));
418 }
419
420
412 //////////////////////////////////////////////////////////////////////////////// 421 ////////////////////////////////////////////////////////////////////////////////
413 422
414 void GrDrawState::AutoViewMatrixRestore::restore() { 423 void GrDrawState::AutoViewMatrixRestore::restore() {
415 if (NULL != fDrawState) { 424 if (NULL != fDrawState) {
416 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) 425 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;)
417 fDrawState->fViewMatrix = fViewMatrix; 426 fDrawState->fViewMatrix = fViewMatrix;
418 SkASSERT(fDrawState->numColorStages() >= fNumColorStages); 427 SkASSERT(fDrawState->numColorStages() >= fNumColorStages);
419 int numCoverageStages = fSavedCoordChanges.count() - fNumColorStages; 428 int numCoverageStages = fSavedCoordChanges.count() - fNumColorStages;
420 SkASSERT(fDrawState->numCoverageStages() >= numCoverageStages); 429 SkASSERT(fDrawState->numCoverageStages() >= numCoverageStages);
421 430
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 fDrawState->fColorStages[s].saveCoordChange(&fSavedCoordChanges[i]); 497 fDrawState->fColorStages[s].saveCoordChange(&fSavedCoordChanges[i]);
489 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix); 498 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix);
490 } 499 }
491 500
492 int numCoverageStages = fDrawState->numCoverageStages(); 501 int numCoverageStages = fDrawState->numCoverageStages();
493 for (int s = 0; s < numCoverageStages; ++s, ++i) { 502 for (int s = 0; s < numCoverageStages; ++s, ++i) {
494 fDrawState->fCoverageStages[s].saveCoordChange(&fSavedCoordChanges[i]); 503 fDrawState->fCoverageStages[s].saveCoordChange(&fSavedCoordChanges[i]);
495 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix); 504 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix);
496 } 505 }
497 } 506 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.h ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698