OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrPipelineBuilder.h" | 8 #include "GrPipelineBuilder.h" |
9 | 9 |
10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 fPipelineBuilder = pipelineBuilder; | 110 fPipelineBuilder = pipelineBuilder; |
111 if (NULL != pipelineBuilder) { | 111 if (NULL != pipelineBuilder) { |
112 fColorEffectCnt = pipelineBuilder->numColorFragmentStages(); | 112 fColorEffectCnt = pipelineBuilder->numColorFragmentStages(); |
113 fCoverageEffectCnt = pipelineBuilder->numCoverageFragmentStages(); | 113 fCoverageEffectCnt = pipelineBuilder->numCoverageFragmentStages(); |
114 SkDEBUGCODE(++pipelineBuilder->fBlockEffectRemovalCnt;) | 114 SkDEBUGCODE(++pipelineBuilder->fBlockEffectRemovalCnt;) |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 //////////////////////////////////////////////////////////////////////////////// | 118 //////////////////////////////////////////////////////////////////////////////// |
119 | 119 |
120 // Some blend modes allow folding a fractional coverage value into the color's a
lpha channel, while | |
121 // others will blend incorrectly. | |
122 bool GrPipelineBuilder::canTweakAlphaForCoverage() const { | |
123 return this->getXPFactory()->canTweakAlphaForCoverage(); | |
124 } | |
125 | |
126 //////////////////////////////////////////////////////////////////////////////// | |
127 | |
128 GrPipelineBuilder::~GrPipelineBuilder() { | 120 GrPipelineBuilder::~GrPipelineBuilder() { |
129 SkASSERT(0 == fBlockEffectRemovalCnt); | 121 SkASSERT(0 == fBlockEffectRemovalCnt); |
130 } | 122 } |
131 | 123 |
132 //////////////////////////////////////////////////////////////////////////////// | 124 //////////////////////////////////////////////////////////////////////////////// |
133 | 125 |
134 bool GrPipelineBuilder::willBlendWithDst(const GrPrimitiveProcessor* pp) const { | 126 bool GrPipelineBuilder::willBlendWithDst(const GrPrimitiveProcessor* pp) const { |
135 this->calcColorInvariantOutput(pp); | 127 this->calcColorInvariantOutput(pp); |
136 this->calcCoverageInvariantOutput(pp); | 128 this->calcCoverageInvariantOutput(pp); |
137 | 129 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const { | 169 void GrPipelineBuilder::calcCoverageInvariantOutput(GrColor coverage) const { |
178 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { | 170 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { |
179 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; | 171 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; |
180 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), | 172 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), |
181 this->numCoverageFragmentStages(
), coverage, flags, | 173 this->numCoverageFragmentStages(
), coverage, flags, |
182 true); | 174 true); |
183 fCoverageProcInfoValid = true; | 175 fCoverageProcInfoValid = true; |
184 fCoverageCache = coverage; | 176 fCoverageCache = coverage; |
185 } | 177 } |
186 } | 178 } |
OLD | NEW |