Start to propagate constness of GrPipelineBuilder up the stack
BUG=skia:
Review URL: https://codereview.chromium.org/1229143007
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 4763ca7..ba06c66 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -126,9 +126,7 @@
this->reset();
}
-void GrDrawTarget::drawBatch(GrPipelineBuilder* pipelineBuilder,
- GrBatch* batch) {
- SkASSERT(pipelineBuilder);
+void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrBatch* batch) {
// TODO some kind of checkdraw, but not at this level
// Setup clip
@@ -189,14 +187,13 @@
this->clipMaskManager()->adjustPathStencilParams(sb, outStencilSettings);
}
-void GrDrawTarget::stencilPath(GrPipelineBuilder* pipelineBuilder,
+void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
const GrPathProcessor* pathProc,
const GrPath* path,
GrPathRendering::FillType fill) {
// TODO: extract portions of checkDraw that are relevant to path stenciling.
SkASSERT(path);
SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
- SkASSERT(pipelineBuilder);
// Setup clip
GrScissorState scissorState;
@@ -209,21 +206,20 @@
// set stencil settings for path
GrStencilSettings stencilSettings;
- GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
+ GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
- this->onStencilPath(*pipelineBuilder, pathProc, path, scissorState, stencilSettings);
+ this->onStencilPath(pipelineBuilder, pathProc, path, scissorState, stencilSettings);
}
-void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder,
+void GrDrawTarget::drawPath(const GrPipelineBuilder& pipelineBuilder,
const GrPathProcessor* pathProc,
const GrPath* path,
GrPathRendering::FillType fill) {
// TODO: extract portions of checkDraw that are relevant to path rendering.
SkASSERT(path);
SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
- SkASSERT(pipelineBuilder);
SkRect devBounds = path->getBounds();
pathProc->viewMatrix().mapRect(&devBounds);
@@ -239,7 +235,7 @@
// set stencil settings for path
GrStencilSettings stencilSettings;
- GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
+ GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
@@ -252,7 +248,7 @@
this->onDrawPath(pathProc, path, stencilSettings, pipelineInfo);
}
-void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
+void GrDrawTarget::drawPaths(const GrPipelineBuilder& pipelineBuilder,
const GrPathProcessor* pathProc,
const GrPathRange* pathRange,
const void* indices,
@@ -266,7 +262,6 @@
SkASSERT(indices);
SkASSERT(0 == reinterpret_cast<long>(indices) % GrPathRange::PathIndexSizeInBytes(indexType));
SkASSERT(transformValues);
- SkASSERT(pipelineBuilder);
// Setup clip
GrScissorState scissorState;
@@ -279,7 +274,7 @@
// set stencil settings for path
GrStencilSettings stencilSettings;
- GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
+ GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
GrStencilAttachment* sb = rt->renderTargetPriv().attachStencilAttachment();
this->getPathStencilSettingsForFilltype(fill, sb, &stencilSettings);
@@ -296,18 +291,18 @@
transformType, count, stencilSettings, pipelineInfo);
}
-void GrDrawTarget::drawBWRect(GrPipelineBuilder* pipelineBuilder,
- GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect* localRect,
- const SkMatrix* localMatrix) {
+void GrDrawTarget::drawBWRect(const GrPipelineBuilder& pipelineBuilder,
+ GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect* localRect,
+ const SkMatrix* localMatrix) {
SkAutoTUnref<GrBatch> batch(GrRectBatch::Create(color, viewMatrix, rect, localRect,
localMatrix));
this->drawBatch(pipelineBuilder, batch);
}
-void GrDrawTarget::drawAARect(GrPipelineBuilder* pipelineBuilder,
+void GrDrawTarget::drawAARect(const GrPipelineBuilder& pipelineBuilder,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
@@ -333,7 +328,7 @@
GrPipelineBuilder pipelineBuilder;
pipelineBuilder.setRenderTarget(renderTarget);
- this->drawSimpleRect(&pipelineBuilder, color, SkMatrix::I(), *rect);
+ this->drawSimpleRect(pipelineBuilder, color, SkMatrix::I(), *rect);
} else {
this->onClear(rect, color, canIgnoreRect, renderTarget);
}
@@ -466,12 +461,12 @@
}
///////////////////////////////////////////////////////////////////////////////
-GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder,
+GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder& pipelineBuilder,
GrScissorState* scissor,
const GrPrimitiveProcessor* primProc,
const SkRect* devBounds,
GrDrawTarget* target)
- : fPipelineBuilder(pipelineBuilder)
+ : fPipelineBuilder(&pipelineBuilder)
, fScissor(scissor) {
fColorPOI = fPipelineBuilder->colorProcInfo(primProc);
fCoveragePOI = fPipelineBuilder->coverageProcInfo(primProc);
@@ -481,12 +476,12 @@
}
}
-GrDrawTarget::PipelineInfo::PipelineInfo(GrPipelineBuilder* pipelineBuilder,
+GrDrawTarget::PipelineInfo::PipelineInfo(const GrPipelineBuilder& pipelineBuilder,
GrScissorState* scissor,
const GrBatch* batch,
const SkRect* devBounds,
GrDrawTarget* target)
- : fPipelineBuilder(pipelineBuilder)
+ : fPipelineBuilder(&pipelineBuilder)
, fScissor(scissor) {
fColorPOI = fPipelineBuilder->colorProcInfo(batch);
fCoveragePOI = fPipelineBuilder->coverageProcInfo(batch);
@@ -504,13 +499,13 @@
}
-bool GrClipTarget::setupClip(GrPipelineBuilder* pipelineBuilder,
+bool GrClipTarget::setupClip(const GrPipelineBuilder& pipelineBuilder,
GrPipelineBuilder::AutoRestoreFragmentProcessors* arfp,
GrPipelineBuilder::AutoRestoreStencil* ars,
GrPipelineBuilder::AutoRestoreProcessorDataManager* arpdm,
GrScissorState* scissorState,
const SkRect* devBounds) {
- return fClipMaskManager->setupClipping(*pipelineBuilder,
+ return fClipMaskManager->setupClipping(pipelineBuilder,
arfp,
ars,
arpdm,