diff options
author | 2013-02-01 14:19:27 +0000 | |
---|---|---|
committer | 2013-02-01 14:19:27 +0000 | |
commit | d62e88e5af39347a8fc2a5abdf5feb67d7ea256d (patch) | |
tree | aae6adc4d6cb208d0eb9758266abd95f08ac0ad0 /src/gpu/GrDrawState.cpp | |
parent | 2bc4c35733fa1adecaab2551cba4df5a7ff6935b (diff) |
Make drawIndexedInstances non-virtual and rewrite GrIODB's drawRect on top of drawIndexedInstances.
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/7221078
git-svn-id: http://skia.googlecode.com/svn/trunk@7508 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrDrawState.cpp')
-rw-r--r-- | src/gpu/GrDrawState.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp index 6079272246..b6c521f093 100644 --- a/src/gpu/GrDrawState.cpp +++ b/src/gpu/GrDrawState.cpp @@ -530,6 +530,32 @@ bool GrDrawState::srcAlphaWillBeOne(GrVertexLayout layout) const { return (GrEffect::kA_ValidComponentFlag & validComponentFlags) && 0xff == GrColorUnpackA(color); } +bool GrDrawState::hasSolidCoverage(GrVertexLayout layout) const { + // If we're drawing coverage directly then coverage is effectively treated as color. + if (this->isCoverageDrawing()) { + return true; + } + + GrColor coverage; + uint32_t validComponentFlags; + // Initialize to an unknown starting coverage if per-vertex coverage is specified. + if (layout & kCoverage_VertexLayoutBit) { + validComponentFlags = 0; + } else { + coverage = fCommon.fCoverage; + validComponentFlags = GrEffect::kAll_ValidComponentFlags; + } + + // Run through the coverage stages and see if the coverage will be all ones at the end. + for (int s = this->getFirstCoverageStage(); s < GrDrawState::kNumStages; ++s) { + const GrEffectRef* effect = this->getStage(s).getEffect(); + if (NULL != effect) { + (*effect)->getConstantColorComponents(&coverage, &validComponentFlags); + } + } + return (GrEffect::kAll_ValidComponentFlags == validComponentFlags) && (0xffffffff == coverage); +} + //////////////////////////////////////////////////////////////////////////////// void GrDrawState::AutoViewMatrixRestore::restore() { |