Index: src/gpu/GrPipelineBuilder.cpp |
diff --git a/src/gpu/GrPipelineBuilder.cpp b/src/gpu/GrPipelineBuilder.cpp |
index 0fb8ac0ccaa3a8c32e4dc1493ce168106399f6fe..64a1d0c4280301a49e95ad8299397a5faeb8424e 100644 |
--- a/src/gpu/GrPipelineBuilder.cpp |
+++ b/src/gpu/GrPipelineBuilder.cpp |
@@ -22,6 +22,20 @@ |
SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) |
} |
+GrPipelineBuilder& GrPipelineBuilder::operator=(const GrPipelineBuilder& that) { |
+ fProcDataManager.reset(SkNEW_ARGS(GrProcessorDataManager, (*that.processorDataManager()))); |
+ fRenderTarget.reset(SkSafeRef(that.fRenderTarget.get())); |
+ fFlags = that.fFlags; |
+ fStencilSettings = that.fStencilSettings; |
+ fDrawFace = that.fDrawFace; |
+ fXPFactory.reset(SkRef(that.getXPFactory())); |
+ fColorStages = that.fColorStages; |
+ fCoverageStages = that.fCoverageStages; |
+ fClip = that.fClip; |
+ |
+ return *this; |
+} |
+ |
GrPipelineBuilder::GrPipelineBuilder(const GrPaint& paint, GrRenderTarget* rt, const GrClip& clip) { |
SkDEBUGCODE(fBlockEffectRemovalCnt = 0;) |
@@ -29,12 +43,15 @@ |
fProcDataManager.reset( |
const_cast<GrProcessorDataManager*>(SkRef(paint.processorDataManager()))); |
- for (int i = 0; i < paint.numColorFragmentProcessors(); ++i) { |
- fColorFragmentProcessors.push_back(SkRef(paint.getColorFragmentProcessor(i))); |
+ fColorStages.reset(); |
+ fCoverageStages.reset(); |
+ |
+ for (int i = 0; i < paint.numColorStages(); ++i) { |
+ fColorStages.push_back(paint.getColorStage(i)); |
} |
- for (int i = 0; i < paint.numCoverageFragmentProcessors(); ++i) { |
- fCoverageFragmentProcessors.push_back(SkRef(paint.getCoverageFragmentProcessor(i))); |
+ for (int i = 0; i < paint.numCoverageStages(); ++i) { |
+ fCoverageStages.push_back(paint.getCoverageStage(i)); |
} |
fXPFactory.reset(SkRef(paint.getXPFactory())); |
@@ -65,26 +82,21 @@ |
void GrPipelineBuilder::AutoRestoreFragmentProcessorState::set( |
const GrPipelineBuilder* pipelineBuilder) { |
if (fPipelineBuilder) { |
- int m = fPipelineBuilder->numColorFragmentProcessors() - fColorEffectCnt; |
+ int m = fPipelineBuilder->numColorFragmentStages() - fColorEffectCnt; |
SkASSERT(m >= 0); |
- for (int i = 0; i < m; ++i) { |
- fPipelineBuilder->fColorFragmentProcessors.fromBack(i)->unref(); |
- } |
- fPipelineBuilder->fColorFragmentProcessors.pop_back_n(m); |
+ fPipelineBuilder->fColorStages.pop_back_n(m); |
- int n = fPipelineBuilder->numCoverageFragmentProcessors() - fCoverageEffectCnt; |
+ int n = fPipelineBuilder->numCoverageFragmentStages() - fCoverageEffectCnt; |
SkASSERT(n >= 0); |
- for (int i = 0; i < n; ++i) { |
- fPipelineBuilder->fCoverageFragmentProcessors.fromBack(i)->unref(); |
- } |
- fPipelineBuilder->fCoverageFragmentProcessors.pop_back_n(n); |
+ fPipelineBuilder->fCoverageStages.pop_back_n(n); |
+ |
SkDEBUGCODE(--fPipelineBuilder->fBlockEffectRemovalCnt;) |
fPipelineBuilder->getProcessorDataManager()->restoreToSaveMarker(/*fSaveMarker*/); |
} |
fPipelineBuilder = const_cast<GrPipelineBuilder*>(pipelineBuilder); |
if (NULL != pipelineBuilder) { |
- fColorEffectCnt = pipelineBuilder->numColorFragmentProcessors(); |
- fCoverageEffectCnt = pipelineBuilder->numCoverageFragmentProcessors(); |
+ fColorEffectCnt = pipelineBuilder->numColorFragmentStages(); |
+ fCoverageEffectCnt = pipelineBuilder->numCoverageFragmentStages(); |
SkDEBUGCODE(++pipelineBuilder->fBlockEffectRemovalCnt;) |
fSaveMarker = pipelineBuilder->processorDataManager()->currentSaveMarker(); |
} |
@@ -94,33 +106,25 @@ |
GrPipelineBuilder::~GrPipelineBuilder() { |
SkASSERT(0 == fBlockEffectRemovalCnt); |
- for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { |
- fColorFragmentProcessors[i]->unref(); |
- } |
- for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { |
- fCoverageFragmentProcessors[i]->unref(); |
- } |
} |
//////////////////////////////////////////////////////////////////////////////// |
void GrPipelineBuilder::calcColorInvariantOutput(const GrPrimitiveProcessor* pp) const { |
- fColorProcInfo.calcColorWithPrimProc(pp, fColorFragmentProcessors.begin(), |
- this->numColorFragmentProcessors()); |
- |
+ fColorProcInfo.calcColorWithPrimProc(pp, fColorStages.begin(), this->numColorFragmentStages()); |
} |
void GrPipelineBuilder::calcCoverageInvariantOutput(const GrPrimitiveProcessor* pp) const { |
- fCoverageProcInfo.calcCoverageWithPrimProc(pp, fCoverageFragmentProcessors.begin(), |
- this->numCoverageFragmentProcessors()); |
+ fCoverageProcInfo.calcCoverageWithPrimProc(pp, fCoverageStages.begin(), |
+ this->numCoverageFragmentStages()); |
} |
void GrPipelineBuilder::calcColorInvariantOutput(const GrDrawBatch* batch) const { |
- fColorProcInfo.calcColorWithBatch(batch, fColorFragmentProcessors.begin(), |
- this->numColorFragmentProcessors()); |
+ fColorProcInfo.calcColorWithBatch(batch, fColorStages.begin(), this->numColorFragmentStages()); |
} |
void GrPipelineBuilder::calcCoverageInvariantOutput(const GrDrawBatch* batch) const { |
- fCoverageProcInfo.calcCoverageWithBatch(batch, fCoverageFragmentProcessors.begin(), |
- this->numCoverageFragmentProcessors()); |
+ fCoverageProcInfo.calcCoverageWithBatch(batch, fCoverageStages.begin(), |
+ this->numCoverageFragmentStages()); |
} |
+ |