Index: src/gpu/GrProcOptInfo.cpp |
diff --git a/src/gpu/GrProcOptInfo.cpp b/src/gpu/GrProcOptInfo.cpp |
index a84ac2e17fb45dcfb2a9f556b2a628dd68bcf53f..34f62c8d17160224ef6f478e0ea21f2195ee06b1 100644 |
--- a/src/gpu/GrProcOptInfo.cpp |
+++ b/src/gpu/GrProcOptInfo.cpp |
@@ -11,31 +11,49 @@ |
#include "GrFragmentStage.h" |
#include "GrGeometryProcessor.h" |
+void GrProcOptInfo::calcColorWithPrimProc(const GrPrimitiveProcessor* pp, |
+ const GrFragmentStage* stages, |
+ int stageCount) { |
+ GrInitInvariantOutput out; |
+ pp->computeOutputColor(&out); |
+ fInOut.reset(out); |
+ this->internalCalc(stages, stageCount); |
+} |
+ |
+void GrProcOptInfo::calcCoverageWithPrimProc(const GrPrimitiveProcessor* pp, |
+ const GrFragmentStage* stages, |
+ int stageCount) { |
+ GrInitInvariantOutput out; |
+ pp->computeOutputCoverage(&out); |
+ fInOut.reset(out); |
+ this->internalCalc(stages, stageCount); |
+} |
+ |
void GrProcOptInfo::calcWithInitialValues(const GrFragmentStage* stages, |
int stageCount, |
GrColor startColor, |
GrColorComponentFlags flags, |
- bool areCoverageStages, |
- const GrGeometryProcessor* gp) { |
- fInOut.reset(startColor, flags, areCoverageStages); |
+ bool areCoverageStages) { |
+ GrInitInvariantOutput out; |
+ out.fIsSingleComponent = areCoverageStages; |
+ out.fColor = startColor; |
+ out.fValidFlags = flags; |
+ this->internalCalc(stages, stageCount); |
+} |
+ |
+void GrProcOptInfo::internalCalc(const GrFragmentStage* stages, int stageCount) { |
fFirstEffectStageIndex = 0; |
fInputColorIsUsed = true; |
- fInputColor = startColor; |
+ fInputColor = fInOut.color(); |
fRemoveVertexAttrib = false; |
fReadsDst = false; |
fReadsFragPosition = false; |
- if (areCoverageStages && gp) { |
- gp->computeInvariantOutput(&fInOut); |
- } |
- |
for (int i = 0; i < stageCount; ++i) { |
const GrFragmentProcessor* processor = stages[i].getProcessor(); |
fInOut.resetWillUseInputColor(); |
processor->computeInvariantOutput(&fInOut); |
-#ifdef SK_DEBUG |
- fInOut.validate(); |
-#endif |
+ SkDEBUGCODE(fInOut.validate()); |
if (!fInOut.willUseInputColor()) { |
fFirstEffectStageIndex = i; |
fInputColorIsUsed = false; |
@@ -63,4 +81,3 @@ void GrProcOptInfo::calcWithInitialValues(const GrFragmentStage* stages, |
} |
} |
} |
- |