Start to propagate constness of GrPipelineBuilder up the stack

BUG=skia:

Review URL: https://codereview.chromium.org/1229143007
This commit is contained in:
joshualitt 2015-07-13 08:08:25 -07:00 committed by Commit bot
parent 5e6ba21f07
commit 1c735488cb
30 changed files with 102 additions and 106 deletions

View File

@ -229,7 +229,7 @@ protected:
SkAutoTUnref<GrBatch> batch(
BezierCubicOrConicTestBatch::Create(gp, geometry, klmEqs, klmSigns[c]));
tt.target()->drawBatch(&pipelineBuilder, batch);
tt.target()->drawBatch(pipelineBuilder, batch);
}
++col;
if (numCols == col) {
@ -374,7 +374,7 @@ protected:
SkAutoTUnref<GrBatch> batch(
BezierCubicOrConicTestBatch::Create(gp, geometry, klmEqs, 1.f));
tt.target()->drawBatch(&pipelineBuilder, batch);
tt.target()->drawBatch(pipelineBuilder, batch);
}
++col;
if (numCols == col) {
@ -612,7 +612,7 @@ protected:
SkAutoTUnref<GrBatch> batch(BezierQuadTestBatch::Create(gp, geometry, DevToUV));
tt.target()->drawBatch(&pipelineBuilder, batch);
tt.target()->drawBatch(pipelineBuilder, batch);
}
++col;
if (numCols == col) {

View File

@ -115,7 +115,7 @@ protected:
GrPipelineBuilder pipelineBuilder(grPaint, rt, clip);
pipelineBuilder.addColorProcessor(fp);
tt.target()->drawSimpleRect(&pipelineBuilder,
tt.target()->drawSimpleRect(pipelineBuilder,
grPaint.getColor(),
viewMatrix,
renderRect);

View File

@ -195,7 +195,7 @@ protected:
SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geometry));
tt.target()->drawBatch(&pipelineBuilder, batch);
tt.target()->drawBatch(pipelineBuilder, batch);
x += SkScalarCeilToScalar(path->getBounds().width() + 10.f);
}
@ -244,7 +244,7 @@ protected:
SkAutoTUnref<GrBatch> batch(ConvexPolyTestBatch::Create(gp, geometry));
tt.target()->drawBatch(&pipelineBuilder, batch);
tt.target()->drawBatch(pipelineBuilder, batch);
x += SkScalarCeilToScalar(rect.width() + 10.f);
}

View File

@ -120,7 +120,7 @@ protected:
SkRect bounds = rrect.getBounds();
bounds.outset(2.f, 2.f);
tt.target()->drawSimpleRect(&pipelineBuilder,
tt.target()->drawSimpleRect(pipelineBuilder,
0xff000000,
SkMatrix::I(),
bounds);

View File

@ -130,7 +130,7 @@ protected:
pipelineBuilder.setRenderTarget(rt);
pipelineBuilder.addColorProcessor(fp);
tt.target()->drawSimpleRect(&pipelineBuilder,
tt.target()->drawSimpleRect(pipelineBuilder,
GrColor_WHITE,
viewMatrix,
renderRect);

View File

@ -124,7 +124,7 @@ protected:
viewMatrix.setTranslate(x, y);
pipelineBuilder.setRenderTarget(rt);
pipelineBuilder.addColorProcessor(fp);
tt.target()->drawSimpleRect(&pipelineBuilder,
tt.target()->drawSimpleRect(pipelineBuilder,
GrColor_WHITE,
viewMatrix,
renderRect);

View File

@ -1001,7 +1001,7 @@ bool GrAAConvexPathRenderer::onDrawPath(GrDrawTarget* target,
geometry.fPath = path;
SkAutoTUnref<GrBatch> batch(AAConvexPathBatch::Create(geometry));
target->drawBatch(pipelineBuilder, batch);
target->drawBatch(*pipelineBuilder, batch);
return true;

View File

@ -583,7 +583,7 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(GrDrawTarget* target,
SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color, viewMatrix,
fAtlas, &fPathCache, &fPathList));
target->drawBatch(pipelineBuilder, batch);
target->drawBatch(*pipelineBuilder, batch);
return true;
}

View File

@ -983,7 +983,7 @@ bool GrAAHairLinePathRenderer::onDrawPath(GrDrawTarget* target,
SkAutoTUnref<GrBatch> batch(create_hairline_batch(color, viewMatrix, path, stroke,
devClipBounds));
target->drawBatch(pipelineBuilder, batch);
target->drawBatch(*pipelineBuilder, batch);
return true;
}

View File

@ -318,7 +318,7 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(GrDrawTarget* target,
geometry.fMiterLimit = stroke.getMiter();
SkAutoTUnref<GrBatch> batch(AAFlatteningConvexPathBatch::Create(geometry));
target->drawBatch(pipelineBuilder, batch);
target->drawBatch(*pipelineBuilder, batch);
return true;
}

View File

@ -314,7 +314,7 @@ enum CoverageAttribType {
}
void GrAARectRenderer::GeometryFillAARect(GrDrawTarget* target,
GrPipelineBuilder* pipelineBuilder,
const GrPipelineBuilder& pipelineBuilder,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
@ -331,7 +331,7 @@ void GrAARectRenderer::GeometryFillAARect(GrDrawTarget* target,
}
void GrAARectRenderer::StrokeAARect(GrDrawTarget* target,
GrPipelineBuilder* pipelineBuilder,
const GrPipelineBuilder& pipelineBuilder,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
@ -773,7 +773,7 @@ private:
};
void GrAARectRenderer::GeometryStrokeAARect(GrDrawTarget* target,
GrPipelineBuilder* pipelineBuilder,
const GrPipelineBuilder& pipelineBuilder,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect& devOutside,
@ -792,7 +792,7 @@ void GrAARectRenderer::GeometryStrokeAARect(GrDrawTarget* target,
}
void GrAARectRenderer::FillAANestedRects(GrDrawTarget* target,
GrPipelineBuilder* pipelineBuilder,
const GrPipelineBuilder& pipelineBuilder,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect rects[2]) {

View File

@ -27,7 +27,7 @@ public:
// between them by passing in stroke (==NULL means fill).
static void FillAARect(GrDrawTarget* target,
GrPipelineBuilder* pipelineBuilder,
const GrPipelineBuilder& pipelineBuilder,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
@ -36,7 +36,7 @@ public:
}
static void StrokeAARect(GrDrawTarget*,
GrPipelineBuilder*,
const GrPipelineBuilder&,
GrColor,
const SkMatrix& viewMatrix,
const SkRect& rect,
@ -45,7 +45,7 @@ public:
// First rect is outer; second rect is inner
static void FillAANestedRects(GrDrawTarget*,
GrPipelineBuilder*,
const GrPipelineBuilder&,
GrColor,
const SkMatrix& viewMatrix,
const SkRect rects[2]);
@ -54,14 +54,14 @@ private:
GrAARectRenderer();
static void GeometryFillAARect(GrDrawTarget*,
GrPipelineBuilder*,
const GrPipelineBuilder&,
GrColor,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkRect& devRect);
static void GeometryStrokeAARect(GrDrawTarget*,
GrPipelineBuilder*,
const GrPipelineBuilder&,
GrColor,
const SkMatrix& viewMatrix,
const SkRect& devOutside,

View File

@ -409,10 +409,10 @@ bool GrClipMaskManager::drawElement(GrPipelineBuilder* pipelineBuilder,
SkRect devRect = element->getRect();
viewMatrix.mapRect(&devRect);
fClipTarget->drawAARect(pipelineBuilder, color, viewMatrix,
fClipTarget->drawAARect(*pipelineBuilder, color, viewMatrix,
element->getRect(), devRect);
} else {
fClipTarget->drawSimpleRect(pipelineBuilder, color, viewMatrix,
fClipTarget->drawSimpleRect(*pipelineBuilder, color, viewMatrix,
element->getRect());
}
return true;
@ -492,7 +492,7 @@ void GrClipMaskManager::mergeMask(GrPipelineBuilder* pipelineBuilder,
GrTextureParams::kNone_FilterMode))->unref();
// The color passed in here does not matter since the coverageSetOpXP won't read it.
fClipTarget->drawSimpleRect(pipelineBuilder,
fClipTarget->drawSimpleRect(*pipelineBuilder,
GrColor_WHITE,
SkMatrix::I(),
SkRect::Make(dstBound));
@ -686,7 +686,7 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
backgroundPipelineBuilder.setStencil(kDrawOutsideElement);
// The color passed in here does not matter since the coverageSetOpXP won't read it.
fClipTarget->drawSimpleRect(&backgroundPipelineBuilder, GrColor_WHITE, translate,
fClipTarget->drawSimpleRect(backgroundPipelineBuilder, GrColor_WHITE, translate,
clipSpaceIBounds);
}
} else {
@ -823,7 +823,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
*pipelineBuilder.stencil() = gDrawToStencil;
// We need this AGP until everything is in GrBatch
fClipTarget->drawSimpleRect(&pipelineBuilder,
fClipTarget->drawSimpleRect(pipelineBuilder,
GrColor_WHITE,
viewMatrix,
element->getRect());
@ -850,7 +850,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
if (canDrawDirectToClip) {
if (Element::kRect_Type == element->getType()) {
// We need this AGP until everything is in GrBatch
fClipTarget->drawSimpleRect(&pipelineBuilder,
fClipTarget->drawSimpleRect(pipelineBuilder,
GrColor_WHITE,
viewMatrix,
element->getRect());
@ -861,7 +861,7 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
} else {
// The view matrix is setup to do clip space -> stencil space translation, so
// draw rect in clip space.
fClipTarget->drawSimpleRect(&pipelineBuilder,
fClipTarget->drawSimpleRect(pipelineBuilder,
GrColor_WHITE,
viewMatrix,
SkRect::Make(clipSpaceIBounds));

View File

@ -32,6 +32,6 @@ bool GrDashLinePathRenderer::onDrawPath(GrDrawTarget* target,
bool useAA) {
SkPoint pts[2];
SkAssertResult(path.isLine(pts));
return GrDashingEffect::DrawDashLine(target, pipelineBuilder, color,
return GrDashingEffect::DrawDashLine(target, *pipelineBuilder, color,
viewMatrix, pts, useAA, stroke);
}

View File

@ -678,7 +678,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
}
const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() :
viewMatrix;
target->drawBWRect(pipelineBuilder, color, viewM, bounds, NULL, &localMatrix);
target->drawBWRect(*pipelineBuilder, color, viewM, bounds, NULL, &localMatrix);
} else {
if (passCount > 1) {
pipelineBuilder->setDisableColorXPFactory();
@ -692,7 +692,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
SkAutoTUnref<GrBatch> batch(DefaultPathBatch::Create(geometry, newCoverage, viewMatrix,
isHairline, devBounds));
target->drawBatch(pipelineBuilder, batch);
target->drawBatch(*pipelineBuilder, batch);
}
}
return true;

View File

@ -116,7 +116,7 @@ void GrDrawContext::drawPaths(GrPipelineBuilder* pipelineBuilder,
int /*GrDrawTarget::PathTransformType*/ transformType,
int count,
int /*GrPathRendering::FillType*/ fill) {
fDrawTarget->drawPaths(pipelineBuilder, pathProc, pathRange,
fDrawTarget->drawPaths(*pipelineBuilder, pathProc, pathRange,
indices, (GrDrawTarget::PathIndexType) indexType,
transformValues,
(GrDrawTarget::PathTransformType) transformType,
@ -192,7 +192,7 @@ void GrDrawContext::drawPaint(GrRenderTarget* rt,
}
GrPipelineBuilder pipelineBuilder(*paint, rt, clip);
fDrawTarget->drawBWRect(&pipelineBuilder,
fDrawTarget->drawBWRect(pipelineBuilder,
paint->getColor(),
SkMatrix::I(),
r,
@ -487,7 +487,7 @@ void GrDrawContext::drawRect(GrRenderTarget* rt,
if (doAA) {
if (width >= 0) {
GrAARectRenderer::StrokeAARect(fDrawTarget,
&pipelineBuilder,
pipelineBuilder,
color,
viewMatrix,
rect,
@ -496,7 +496,7 @@ void GrDrawContext::drawRect(GrRenderTarget* rt,
} else {
// filled AA rect
GrAARectRenderer::FillAARect(fDrawTarget,
&pipelineBuilder,
pipelineBuilder,
color,
viewMatrix,
rect,
@ -521,10 +521,10 @@ void GrDrawContext::drawRect(GrRenderTarget* rt,
// is enabled because it can cause ugly artifacts.
pipelineBuilder.setState(GrPipelineBuilder::kSnapVerticesToPixelCenters_Flag,
snapToPixelCenters);
fDrawTarget->drawBatch(&pipelineBuilder, batch);
fDrawTarget->drawBatch(pipelineBuilder, batch);
} else {
// filled BW rect
fDrawTarget->drawSimpleRect(&pipelineBuilder, color, viewMatrix, rect);
fDrawTarget->drawSimpleRect(pipelineBuilder, color, viewMatrix, rect);
}
}
@ -542,7 +542,7 @@ void GrDrawContext::drawNonAARectToRect(GrRenderTarget* rt,
}
GrPipelineBuilder pipelineBuilder(paint, rt, clip);
fDrawTarget->drawBWRect(&pipelineBuilder,
fDrawTarget->drawBWRect(pipelineBuilder,
paint.getColor(),
viewMatrix,
rectToDraw,
@ -861,7 +861,7 @@ void GrDrawContext::drawVertices(GrRenderTarget* rt,
indexCount, colors, texCoords,
bounds));
fDrawTarget->drawBatch(&pipelineBuilder, batch);
fDrawTarget->drawBatch(pipelineBuilder, batch);
}
///////////////////////////////////////////////////////////////////////////////
@ -1075,7 +1075,7 @@ void GrDrawContext::drawPath(GrRenderTarget* rt,
SkRect rects[2];
if (is_nested_rects(viewMatrix, path, strokeInfo, rects)) {
GrAARectRenderer::FillAANestedRects(fDrawTarget, &pipelineBuilder, color,
GrAARectRenderer::FillAANestedRects(fDrawTarget, pipelineBuilder, color,
viewMatrix, rects);
return;
}
@ -1188,7 +1188,7 @@ bool GrDrawContext::prepareToDraw(GrRenderTarget* rt) {
}
void GrDrawContext::drawBatch(GrPipelineBuilder* pipelineBuilder, GrBatch* batch) {
fDrawTarget->drawBatch(pipelineBuilder, batch);
fDrawTarget->drawBatch(*pipelineBuilder, batch);
}
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -126,9 +126,7 @@ void GrDrawTarget::flush() {
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 @@ void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType f
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 @@ void GrDrawTarget::stencilPath(GrPipelineBuilder* pipelineBuilder,
// 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 @@ void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder,
// 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 @@ void GrDrawTarget::drawPath(GrPipelineBuilder* pipelineBuilder,
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 @@ void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
SkASSERT(indices);
SkASSERT(0 == reinterpret_cast<long>(indices) % GrPathRange::PathIndexSizeInBytes(indexType));
SkASSERT(transformValues);
SkASSERT(pipelineBuilder);
// Setup clip
GrScissorState scissorState;
@ -279,7 +274,7 @@ void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
// 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 @@ void GrDrawTarget::drawPaths(GrPipelineBuilder* pipelineBuilder,
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 @@ void GrDrawTarget::clear(const SkIRect* rect,
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 @@ void GrDrawTarget::setupPipeline(const PipelineInfo& pipelineInfo,
}
///////////////////////////////////////////////////////////////////////////////
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(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 @@ GrClipTarget::GrClipTarget(GrContext* context)
}
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,

View File

@ -66,7 +66,7 @@ public:
*/
const GrCaps* caps() const { return fCaps; }
void drawBatch(GrPipelineBuilder*, GrBatch*);
void drawBatch(const GrPipelineBuilder&, GrBatch*);
/**
* Draws path into the stencil buffer. The fill must be either even/odd or
@ -74,14 +74,14 @@ public:
* on the GrPipelineBuilder (if possible in the 3D API). Note, we will never have an inverse
* fill with stencil path
*/
void stencilPath(GrPipelineBuilder*, const GrPathProcessor*, const GrPath*,
void stencilPath(const GrPipelineBuilder&, const GrPathProcessor*, const GrPath*,
GrPathRendering::FillType);
/**
* Draws a path. Fill must not be a hairline. It will respect the HW
* antialias flag on the GrPipelineBuilder (if possible in the 3D API).
*/
void drawPath(GrPipelineBuilder*, const GrPathProcessor*, const GrPath*,
void drawPath(const GrPipelineBuilder&, const GrPathProcessor*, const GrPath*,
GrPathRendering::FillType);
/**
@ -97,7 +97,7 @@ public:
* @param count Number of paths to draw
* @param fill Fill type for drawing all the paths
*/
void drawPaths(GrPipelineBuilder*,
void drawPaths(const GrPipelineBuilder&,
const GrPathProcessor*,
const GrPathRange* pathRange,
const void* indices,
@ -118,7 +118,7 @@ public:
* that rectangle before it is input to GrCoordTransforms that read local
* coordinates
*/
void drawBWRect(GrPipelineBuilder* pipelineBuilder,
void drawBWRect(const GrPipelineBuilder& pipelineBuilder,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
@ -128,17 +128,17 @@ public:
/**
* Helper for drawRect when the caller doesn't need separate local rects or matrices.
*/
void drawSimpleRect(GrPipelineBuilder* ds, GrColor color, const SkMatrix& viewM,
void drawSimpleRect(const GrPipelineBuilder& ds, GrColor color, const SkMatrix& viewM,
const SkRect& rect) {
this->drawBWRect(ds, color, viewM, rect, NULL, NULL);
}
void drawSimpleRect(GrPipelineBuilder* ds, GrColor color, const SkMatrix& viewM,
void drawSimpleRect(const GrPipelineBuilder& ds, GrColor color, const SkMatrix& viewM,
const SkIRect& irect) {
SkRect rect = SkRect::Make(irect);
this->drawBWRect(ds, color, viewM, rect, NULL, NULL);
}
void drawAARect(GrPipelineBuilder* pipelineBuilder,
void drawAARect(const GrPipelineBuilder& pipelineBuilder,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
@ -221,11 +221,11 @@ protected:
const SkRect* drawBounds);
struct PipelineInfo {
PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor,
PipelineInfo(const GrPipelineBuilder& pipelineBuilder, GrScissorState* scissor,
const GrPrimitiveProcessor* primProc,
const SkRect* devBounds, GrDrawTarget* target);
PipelineInfo(GrPipelineBuilder* pipelineBuilder, GrScissorState* scissor,
PipelineInfo(const GrPipelineBuilder& pipelineBuilder, GrScissorState* scissor,
const GrBatch* batch, const SkRect* devBounds,
GrDrawTarget* target);
@ -237,7 +237,7 @@ protected:
bool mustSkipDraw() const { return (NULL == fPipelineBuilder); }
GrPipelineBuilder* fPipelineBuilder;
const GrPipelineBuilder* fPipelineBuilder;
GrScissorState* fScissor;
GrProcOptInfo fColorPOI;
GrProcOptInfo fCoveragePOI;
@ -287,7 +287,7 @@ private:
const GrStencilAttachment*,
GrStencilSettings*);
virtual GrClipMaskManager* clipMaskManager() = 0;
virtual bool setupClip(GrPipelineBuilder*,
virtual bool setupClip(const GrPipelineBuilder&,
GrPipelineBuilder::AutoRestoreFragmentProcessors*,
GrPipelineBuilder::AutoRestoreStencil*,
GrPipelineBuilder::AutoRestoreProcessorDataManager*,
@ -340,7 +340,7 @@ protected:
private:
GrClipMaskManager* clipMaskManager() override { return fClipMaskManager; }
bool setupClip(GrPipelineBuilder*,
bool setupClip(const GrPipelineBuilder&,
GrPipelineBuilder::AutoRestoreFragmentProcessors*,
GrPipelineBuilder::AutoRestoreStencil*,
GrPipelineBuilder::AutoRestoreProcessorDataManager*,

View File

@ -245,7 +245,7 @@ public:
* efficiently succeed. It should only succeed if it can allow copySurface to perform a copy
* that would be more effecient than drawing the src to a dst render target.
*/
virtual bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) = 0;
virtual bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const = 0;
// After the client interacts directly with the 3D context state the GrGpu
// must resync its internal state and assumptions about 3D context state.

View File

@ -832,7 +832,7 @@ void GrOvalRenderer::DrawCircle(GrDrawTarget* target,
const SkStrokeRec& stroke) {
SkAutoTUnref<GrBatch> batch(create_circle_batch(color, viewMatrix, useCoverageAA, circle,
stroke));
target->drawBatch(pipelineBuilder, batch);
target->drawBatch(*pipelineBuilder, batch);
}
///////////////////////////////////////////////////////////////////////////////
@ -1092,7 +1092,7 @@ bool GrOvalRenderer::DrawEllipse(GrDrawTarget* target,
return false;
}
target->drawBatch(pipelineBuilder, batch);
target->drawBatch(*pipelineBuilder, batch);
return true;
}
@ -1336,7 +1336,7 @@ bool GrOvalRenderer::DrawDIEllipse(GrDrawTarget* target,
if (!batch) {
return false;
}
target->drawBatch(pipelineBuilder, batch);
target->drawBatch(*pipelineBuilder, batch);
return true;
}
@ -1444,7 +1444,7 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target,
if (applyAA) {
bounds.outset(SK_ScalarHalf, SK_ScalarHalf);
}
target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), bounds, NULL, &invert);
target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), bounds, NULL, &invert);
return true;
}
@ -1979,7 +1979,7 @@ bool GrOvalRenderer::DrawRRect(GrDrawTarget* target,
return false;
}
target->drawBatch(pipelineBuilder, batch);
target->drawBatch(*pipelineBuilder, batch);
return true;
}

View File

@ -374,5 +374,5 @@ void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
GrTextureParams::kNone_FilterMode,
kDevice_GrCoordSet))->unref();
target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), dstRect, NULL, &invert);
target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), dstRect, NULL, &invert);
}

View File

@ -94,22 +94,22 @@ void draw_around_inv_path(GrDrawTarget* target,
if (devClipBounds.fTop < devPathBounds.fTop) {
rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
devClipBounds.fRight, devPathBounds.fTop);
target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
}
if (devClipBounds.fLeft < devPathBounds.fLeft) {
rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
devPathBounds.fLeft, devPathBounds.fBottom);
target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
}
if (devClipBounds.fRight > devPathBounds.fRight) {
rect.iset(devPathBounds.fRight, devPathBounds.fTop,
devClipBounds.fRight, devPathBounds.fBottom);
target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
}
if (devClipBounds.fBottom > devPathBounds.fBottom) {
rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
devClipBounds.fRight, devClipBounds.fBottom);
target->drawBWRect(pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
target->drawBWRect(*pipelineBuilder, color, SkMatrix::I(), rect, NULL, &invert);
}
}

View File

@ -98,7 +98,7 @@ void GrStencilAndCoverPathRenderer::onStencilPath(GrDrawTarget* target,
SkASSERT(!path.isInverseFillType());
SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE, viewMatrix));
SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, stroke));
target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
target->stencilPath(*pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
}
bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
@ -134,7 +134,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
// fake inverse with a stencil and cover
SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(GrColor_WHITE, viewMatrix));
target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
target->stencilPath(*pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
SkMatrix invert = SkMatrix::I();
SkRect bounds =
@ -154,7 +154,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
}
}
const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : viewMatrix;
target->drawBWRect(pipelineBuilder, color, viewM, bounds, NULL, &invert);
target->drawBWRect(*pipelineBuilder, color, viewM, bounds, NULL, &invert);
} else {
GR_STATIC_CONST_SAME_STENCIL(kStencilPass,
kZero_StencilOp,
@ -166,7 +166,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
pipelineBuilder->setStencil(kStencilPass);
SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatrix));
target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
target->drawPath(*pipelineBuilder, pp, p, convert_skpath_filltype(path.getFillType()));
}
pipelineBuilder->stencil()->setDisabled();

View File

@ -1511,7 +1511,7 @@ bool GrTessellatingPathRenderer::onDrawPath(GrDrawTarget* target,
}
vmi.mapRect(&clipBounds);
SkAutoTUnref<GrBatch> batch(TessellatingPathBatch::Create(color, path, viewM, clipBounds));
target->drawBatch(pipelineBuilder, batch);
target->drawBatch(*pipelineBuilder, batch);
return true;
}

View File

@ -166,7 +166,7 @@ public:
const SkIRect& srcRect,
const SkIPoint& dstPoint) override { return false; };
bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) override {
bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override {
return false;
}

View File

@ -728,11 +728,12 @@ static GrBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const Sk
}
bool GrDashingEffect::DrawDashLine(GrDrawTarget* target,
GrPipelineBuilder* pipelineBuilder, GrColor color,
const GrPipelineBuilder& pipelineBuilder, GrColor color,
const SkMatrix& viewMatrix, const SkPoint pts[2],
bool useAA, const GrStrokeInfo& strokeInfo) {
SkAutoTUnref<GrBatch> batch(create_batch(color, viewMatrix, pts, useAA, strokeInfo,
pipelineBuilder->getRenderTarget()->isUnifiedMultisampled()));
SkAutoTUnref<GrBatch> batch(
create_batch(color, viewMatrix, pts, useAA, strokeInfo,
pipelineBuilder.getRenderTarget()->isUnifiedMultisampled()));
if (!batch) {
return false;
}

View File

@ -20,7 +20,7 @@ class GrPipelineBuilder;
class GrStrokeInfo;
namespace GrDashingEffect {
bool DrawDashLine(GrDrawTarget*, GrPipelineBuilder*, GrColor,
bool DrawDashLine(GrDrawTarget*, const GrPipelineBuilder&, GrColor,
const SkMatrix& viewMatrix, const SkPoint pts[2], bool useAA,
const GrStrokeInfo& strokeInfo);
bool CanDrawDashLine(const SkPoint pts[2], const GrStrokeInfo& strokeInfo,

View File

@ -2676,7 +2676,7 @@ void GrGLGpu::unbindTextureFromFBO(GrGLenum fboTarget) {
0));
}
bool GrGLGpu::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) {
bool GrGLGpu::initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const {
// If the src is a texture, we can implement the blit as a draw assuming the config is
// renderable.
if (src->asTexture() && this->caps()->isConfigRenderable(src->config(), false)) {

View File

@ -70,7 +70,7 @@ public:
size_t rowBytes) const override;
bool fullReadPixelsIsFasterThanPartial() const override;
bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) override;
bool initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) const override;
// These functions should be used to bind GL objects. They track the GL state and skip redundant
// bindings. Making the equivalent glBind calls directly will confuse the state tracking.

View File

@ -251,7 +251,7 @@ bool GrDrawTarget::programUnitTest(GrContext* context, int maxStages) {
set_random_state(&pipelineBuilder, &random);
set_random_stencil(&pipelineBuilder, &random);
this->drawBatch(&pipelineBuilder, batch);
this->drawBatch(pipelineBuilder, batch);
}
// Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes)