diff options
author | 2012-03-29 19:07:12 +0000 | |
---|---|---|
committer | 2012-03-29 19:07:12 +0000 | |
commit | e79c815bca39fa552983b7a8107219aa5084acdb (patch) | |
tree | 054704bb435a6ae4b094089b61eda663dd803ed6 /src/gpu/GrDrawTarget.cpp | |
parent | 257fc5bd135cfc2b9a96e8f51388b8bec717cf0a (diff) |
Don't look at current vertex layout when vertex source hasn't been set
Review URL: http://codereview.appspot.com/5959047
git-svn-id: http://skia.googlecode.com/svn/trunk@3545 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrDrawTarget.cpp')
-rw-r--r-- | src/gpu/GrDrawTarget.cpp | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index 5cce435916..ef03a61417 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -853,9 +853,7 @@ bool GrDrawTarget::canTweakAlphaForCoverage() const { kISC_BlendCoeff == dstCoeff; } - -bool GrDrawTarget::srcAlphaWillBeOne() const { - const GrVertexLayout& layout = this->getGeomSrc().fVertexLayout; +bool GrDrawTarget::srcAlphaWillBeOne(GrVertexLayout layout) const { const GrDrawState& drawState = this->getDrawState(); // Check if per-vertex or constant color may have partial alpha @@ -882,12 +880,28 @@ bool GrDrawTarget::srcAlphaWillBeOne() const { return true; } +namespace { +GrVertexLayout default_blend_opts_vertex_layout() { + GrVertexLayout layout = 0; + for (int s = 0; s < GrDrawState::kNumStages; ++s) { + layout |= GrDrawTarget::StagePosAsTexCoordVertexLayoutBit(s); + } + return layout; +} +} + GrDrawTarget::BlendOptFlags GrDrawTarget::getBlendOpts(bool forceCoverage, GrBlendCoeff* srcCoeff, GrBlendCoeff* dstCoeff) const { - const GrVertexLayout& layout = this->getGeomSrc().fVertexLayout; + GrVertexLayout layout; + if (kNone_GeometrySrcType == this->getGeomSrc().fVertexSrc) { + layout = default_blend_opts_vertex_layout(); + } else { + layout = this->getVertexLayout(); + } + const GrDrawState& drawState = this->getDrawState(); GrBlendCoeff bogusSrcCoeff, bogusDstCoeff; @@ -917,7 +931,7 @@ GrDrawTarget::getBlendOpts(bool forceCoverage, *dstCoeff = kOne_BlendCoeff; } - bool srcAIsOne = this->srcAlphaWillBeOne(); + bool srcAIsOne = this->srcAlphaWillBeOne(layout); bool dstCoeffIsOne = kOne_BlendCoeff == *dstCoeff || (kSA_BlendCoeff == *dstCoeff && srcAIsOne); bool dstCoeffIsZero = kZero_BlendCoeff == *dstCoeff || @@ -1022,11 +1036,6 @@ bool GrDrawTarget::canApplyCoverage() const { kNone_BlendOpt != this->getBlendOpts(true); } -bool GrDrawTarget::drawWillReadDst() const { - return SkToBool((kDisableBlend_BlendOptFlag | kSkipDraw_BlendOptFlag) & - this->getBlendOpts()); -} - //////////////////////////////////////////////////////////////////////////////// void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type, |