Remove fColor from PathRenderer DrawPathArgs struct

This was getting in the way of other refactorings.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2126083002

Review-Url: https://codereview.chromium.org/2126083002
This commit is contained in:
robertphillips 2016-07-07 07:33:13 -07:00 committed by Commit bot
parent 82356cc41f
commit 3950f0d723
20 changed files with 45 additions and 55 deletions

View File

@ -670,7 +670,6 @@ bool GrClipMaskManager::CreateStencilClipMask(GrContext* context,
args.fUserStencilSettings = &kDrawToStencil;
args.fDrawContext = drawContext;
args.fClip = &clip;
args.fColor = GrColor_WHITE;
args.fViewMatrix = &viewMatrix;
args.fShape = &shape;
args.fAntiAlias = false;
@ -710,7 +709,6 @@ bool GrClipMaskManager::CreateStencilClipMask(GrContext* context,
args.fUserStencilSettings = *pass;
args.fDrawContext = drawContext;
args.fClip = &clip;
args.fColor = GrColor_WHITE;
args.fViewMatrix = &viewMatrix;
args.fShape = &shape;
args.fAntiAlias = false;

View File

@ -968,7 +968,6 @@ bool GrDrawContextPriv::drawAndStencilPath(const GrFixedClip& clip,
args.fUserStencilSettings = ss;
args.fDrawContext = fDrawContext;
args.fClip = &clip;
args.fColor = GrColor_WHITE;
args.fViewMatrix = &viewMatrix;
args.fShape = &shape;
args.fAntiAlias = useCoverageAA;
@ -1042,7 +1041,6 @@ void GrDrawContext::internalDrawPath(const GrClip& clip,
args.fUserStencilSettings = &GrUserStencilSettings::kUnused;
args.fDrawContext = this;
args.fClip = &clip;
args.fColor = paint.getColor();
args.fViewMatrix = &viewMatrix;
args.fShape = canDrawArgs.fShape;
args.fAntiAlias = useCoverageAA;

View File

@ -130,7 +130,6 @@ public:
GrDrawContext* fDrawContext;
const GrClip* fClip;
GrColor fColor;
const SkMatrix* fViewMatrix;
const GrShape* fShape;
bool fAntiAlias;
@ -281,7 +280,6 @@ private:
drawArgs.fPaint = &paint;
drawArgs.fUserStencilSettings = &kIncrementStencil;
drawArgs.fDrawContext = args.fDrawContext;
drawArgs.fColor = GrColor_WHITE;
drawArgs.fViewMatrix = args.fViewMatrix;
drawArgs.fShape = args.fShape;
drawArgs.fAntiAlias = false; // In this case the MSAA handles the AA so we want to draw BW

View File

@ -159,10 +159,9 @@ GrTexture* GrSWMaskHelper::DrawShapeMaskToTexture(GrTextureProvider* texProvider
void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture,
GrDrawContext* drawContext,
const GrPaint* paint,
const GrPaint& paint,
const GrUserStencilSettings* userStencilSettings,
const GrClip& clip,
GrColor color,
const SkMatrix& viewMatrix,
const SkIRect& rect) {
SkMatrix invert;
@ -182,7 +181,7 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture,
maskMatrix.setIDiv(texture->width(), texture->height());
maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop));
GrPipelineBuilder pipelineBuilder(*paint, drawContext->mustUseHWAA(*paint));
GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
pipelineBuilder.setUserStencil(userStencilSettings);
pipelineBuilder.addCoverageFragmentProcessor(
@ -191,7 +190,8 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture,
GrTextureParams::kNone_FilterMode,
kDevice_GrCoordSet));
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, SkMatrix::I(),
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(),
SkMatrix::I(),
dstRect, nullptr, &invert));
drawContext->drawBatch(pipelineBuilder, clip, batch);
}

View File

@ -86,10 +86,9 @@ public:
// output of DrawPathMaskToTexture.
static void DrawToTargetWithShapeMask(GrTexture* texture,
GrDrawContext*,
const GrPaint* paint,
const GrPaint& paint,
const GrUserStencilSettings* userStencilSettings,
const GrClip&,
GrColor,
const SkMatrix& viewMatrix,
const SkIRect& rect);

View File

@ -62,27 +62,26 @@ bool get_shape_and_clip_bounds(int width, int height,
}
void GrSoftwarePathRenderer::DrawNonAARect(GrDrawContext* drawContext,
const GrPaint* paint,
const GrPaint& paint,
const GrUserStencilSettings* userStencilSettings,
const GrClip& clip,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkMatrix& localMatrix) {
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, viewMatrix, rect,
SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(paint.getColor(),
viewMatrix, rect,
nullptr, &localMatrix));
GrPipelineBuilder pipelineBuilder(*paint, drawContext->mustUseHWAA(*paint));
GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
pipelineBuilder.setUserStencil(userStencilSettings);
drawContext->drawBatch(pipelineBuilder, clip, batch);
}
void GrSoftwarePathRenderer::DrawAroundInvPath(GrDrawContext* drawContext,
const GrPaint* paint,
const GrPaint& paint,
const GrUserStencilSettings* userStencilSettings,
const GrClip& clip,
GrColor color,
const SkMatrix& viewMatrix,
const SkIRect& devClipBounds,
const SkIRect& devPathBounds) {
@ -95,25 +94,25 @@ void GrSoftwarePathRenderer::DrawAroundInvPath(GrDrawContext* drawContext,
if (devClipBounds.fTop < devPathBounds.fTop) {
rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
devClipBounds.fRight, devPathBounds.fTop);
DrawNonAARect(drawContext, paint, userStencilSettings, clip, color,
DrawNonAARect(drawContext, paint, userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
if (devClipBounds.fLeft < devPathBounds.fLeft) {
rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
devPathBounds.fLeft, devPathBounds.fBottom);
DrawNonAARect(drawContext, paint, userStencilSettings, clip, color,
DrawNonAARect(drawContext, paint, userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
if (devClipBounds.fRight > devPathBounds.fRight) {
rect.iset(devPathBounds.fRight, devPathBounds.fTop,
devClipBounds.fRight, devPathBounds.fBottom);
DrawNonAARect(drawContext, paint, userStencilSettings, clip, color,
DrawNonAARect(drawContext, paint, userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
if (devClipBounds.fBottom > devPathBounds.fBottom) {
rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
devClipBounds.fRight, devClipBounds.fBottom);
DrawNonAARect(drawContext, paint, userStencilSettings, clip, color,
DrawNonAARect(drawContext, paint, userStencilSettings, clip,
SkMatrix::I(), rect, invert);
}
}
@ -138,8 +137,8 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
*args.fClip, *args.fShape,
*args.fViewMatrix, &devShapeBounds, &devClipBounds)) {
if (inverseFilled) {
DrawAroundInvPath(args.fDrawContext, args.fPaint, args.fUserStencilSettings,
*args.fClip, args.fColor,
DrawAroundInvPath(args.fDrawContext, *args.fPaint, args.fUserStencilSettings,
*args.fClip,
*args.fViewMatrix, devClipBounds, devShapeBounds);
}
@ -153,14 +152,14 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
return false;
}
GrSWMaskHelper::DrawToTargetWithShapeMask(texture, args.fDrawContext, args.fPaint,
GrSWMaskHelper::DrawToTargetWithShapeMask(texture, args.fDrawContext, *args.fPaint,
args.fUserStencilSettings,
*args.fClip, args.fColor, *args.fViewMatrix,
*args.fClip, *args.fViewMatrix,
devShapeBounds);
if (inverseFilled) {
DrawAroundInvPath(args.fDrawContext, args.fPaint, args.fUserStencilSettings,
*args.fClip, args.fColor,
DrawAroundInvPath(args.fDrawContext, *args.fPaint, args.fUserStencilSettings,
*args.fClip,
*args.fViewMatrix, devClipBounds, devShapeBounds);
}

View File

@ -21,18 +21,16 @@ public:
GrSoftwarePathRenderer(GrTextureProvider* texProvider) : fTexProvider(texProvider) { }
private:
static void DrawNonAARect(GrDrawContext* drawContext,
const GrPaint* paint,
const GrPaint& paint,
const GrUserStencilSettings* userStencilSettings,
const GrClip& clip,
GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkMatrix& localMatrix);
static void DrawAroundInvPath(GrDrawContext* drawContext,
const GrPaint* paint,
const GrPaint& paint,
const GrUserStencilSettings* userStencilSettings,
const GrClip& clip,
GrColor color,
const SkMatrix& viewMatrix,
const SkIRect& devClipBounds,
const SkIRect& devPathBounds);

View File

@ -999,7 +999,8 @@ bool GrAAConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkPath path;
args.fShape->asPath(&path);
SkAutoTUnref<GrDrawBatch> batch(new AAConvexPathBatch(args.fColor, *args.fViewMatrix, path));
SkAutoTUnref<GrDrawBatch> batch(new AAConvexPathBatch(args.fPaint->getColor(),
*args.fViewMatrix, path));
GrPipelineBuilder pipelineBuilder(*args.fPaint);
pipelineBuilder.setUserStencil(args.fUserStencilSettings);

View File

@ -531,7 +531,8 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
}
SkAutoTUnref<GrDrawBatch> batch(new AADistanceFieldPathBatch(args.fColor, *args.fShape,
SkAutoTUnref<GrDrawBatch> batch(new AADistanceFieldPathBatch(args.fPaint->getColor(),
*args.fShape,
args.fAntiAlias, *args.fViewMatrix,
fAtlas, &fShapeCache, &fShapeList,
args.fGammaCorrect));

View File

@ -968,7 +968,8 @@ bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
SkPath path;
args.fShape->asPath(&path);
SkAutoTUnref<GrDrawBatch> batch(create_hairline_batch(args.fColor, *args.fViewMatrix, path,
SkAutoTUnref<GrDrawBatch> batch(create_hairline_batch(args.fPaint->getColor(),
*args.fViewMatrix, path,
args.fShape->style(), devClipBounds));
GrPipelineBuilder pipelineBuilder(*args.fPaint);

View File

@ -333,7 +333,8 @@ bool GrAALinearizingConvexPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkPaint::Join join = fill ? SkPaint::Join::kMiter_Join : stroke.getJoin();
SkScalar miterLimit = stroke.getMiter();
SkAutoTUnref<GrDrawBatch> batch(new AAFlatteningConvexPathBatch(args.fColor, *args.fViewMatrix,
SkAutoTUnref<GrDrawBatch> batch(new AAFlatteningConvexPathBatch(args.fPaint->getColor(),
*args.fViewMatrix,
path, strokeWidth, join,
miterLimit));

View File

@ -38,7 +38,7 @@ bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
}
SkPoint pts[2];
SkAssertResult(args.fShape->asLine(pts, nullptr));
SkAutoTUnref<GrDrawBatch> batch(GrDashingEffect::CreateDashLineBatch(args.fColor,
SkAutoTUnref<GrDrawBatch> batch(GrDashingEffect::CreateDashLineBatch(args.fPaint->getColor(),
*args.fViewMatrix,
pts,
aaMode,

View File

@ -420,7 +420,6 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
const GrPaint& paint,
const GrUserStencilSettings* userStencilSettings,
const GrClip& clip,
GrColor color,
const SkMatrix& viewMatrix,
const GrShape& shape,
bool stencilOnly) {
@ -557,7 +556,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() :
viewMatrix;
SkAutoTUnref<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(color, viewM, bounds, nullptr,
GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr,
&localMatrix));
GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
@ -570,7 +569,8 @@ bool GrDefaultPathRenderer::internalDrawPath(GrDrawContext* drawContext,
drawContext->drawBatch(pipelineBuilder, clip, batch);
} else {
SkAutoTUnref<GrDrawBatch> batch(new DefaultPathBatch(color, path, srcSpaceTol,
SkAutoTUnref<GrDrawBatch> batch(new DefaultPathBatch(paint.getColor(), path,
srcSpaceTol,
newCoverage, viewMatrix,
isHairline, devBounds));
@ -605,7 +605,6 @@ bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) {
*args.fPaint,
args.fUserStencilSettings,
*args.fClip,
args.fColor,
*args.fViewMatrix,
*args.fShape,
false);
@ -621,7 +620,7 @@ void GrDefaultPathRenderer::onStencilPath(const StencilPathArgs& args) {
paint.setAntiAlias(args.fIsAA);
this->internalDrawPath(args.fDrawContext, paint, &GrUserStencilSettings::kUnused, *args.fClip,
GrColor_WHITE, *args.fViewMatrix, *args.fShape, true);
*args.fViewMatrix, *args.fShape, true);
}
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -34,7 +34,6 @@ private:
const GrPaint&,
const GrUserStencilSettings*,
const GrClip&,
GrColor,
const SkMatrix& viewMatrix,
const GrShape&,
bool stencilOnly);

View File

@ -560,7 +560,6 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext,
const GrPaint& paint,
const GrUserStencilSettings* userStencilSettings,
const GrClip& clip,
GrColor color,
const SkMatrix& viewMatrix,
const GrShape& shape,
bool stencilOnly) {
@ -656,7 +655,7 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext,
const SkMatrix& viewM = (reverse && viewMatrix.hasPerspective()) ? SkMatrix::I() :
viewMatrix;
SkAutoTUnref<GrDrawBatch> batch(
GrRectBatchFactory::CreateNonAAFill(color, viewM, bounds, nullptr,
GrRectBatchFactory::CreateNonAAFill(paint.getColor(), viewM, bounds, nullptr,
&localMatrix));
GrPipelineBuilder pipelineBuilder(paint, drawContext->mustUseHWAA(paint));
@ -669,7 +668,7 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext,
drawContext->drawBatch(pipelineBuilder, clip, batch);
} else {
SkAutoTUnref<MSAAPathBatch> batch(new MSAAPathBatch(color, path, viewMatrix,
SkAutoTUnref<MSAAPathBatch> batch(new MSAAPathBatch(paint.getColor(), path, viewMatrix,
devBounds));
if (!batch->isValid()) {
return false;
@ -713,7 +712,6 @@ bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) {
*args.fPaint,
args.fUserStencilSettings,
*args.fClip,
args.fColor,
*args.fViewMatrix,
*shape,
false);
@ -730,7 +728,7 @@ void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) {
paint.setAntiAlias(args.fIsAA);
this->internalDrawPath(args.fDrawContext, paint, &GrUserStencilSettings::kUnused, *args.fClip,
GrColor_WHITE, *args.fViewMatrix, *args.fShape, true);
*args.fViewMatrix, *args.fShape, true);
}
///////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -25,7 +25,6 @@ private:
const GrPaint&,
const GrUserStencilSettings*,
const GrClip&,
GrColor,
const SkMatrix& viewMatrix,
const GrShape&,
bool stencilOnly);

View File

@ -948,7 +948,8 @@ bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) {
SkPath path;
args.fShape->asPath(&path);
SkAutoTUnref<GrDrawBatch> batch(new PLSPathBatch(args.fColor, path, *args.fViewMatrix));
SkAutoTUnref<GrDrawBatch> batch(new PLSPathBatch(args.fPaint->getColor(),
path, *args.fViewMatrix));
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->mustUseHWAA(*args.fPaint));
pipelineBuilder.setUserStencil(args.fUserStencilSettings);

View File

@ -142,8 +142,8 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : viewMatrix;
SkAutoTUnref<GrDrawBatch> coverBatch(
GrRectBatchFactory::CreateNonAAFill(args.fColor, viewM, bounds, nullptr,
&invert));
GrRectBatchFactory::CreateNonAAFill(args.fPaint->getColor(), viewM, bounds,
nullptr, &invert));
{
GrPipelineBuilder pipelineBuilder(*args.fPaint,
@ -165,7 +165,7 @@ bool GrStencilAndCoverPathRenderer::onDrawPath(const DrawPathArgs& args) {
);
SkAutoTUnref<GrDrawBatch> batch(
GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(), p));
GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(), p->getFillType(), p));
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias());
pipelineBuilder.setUserStencil(&kCoverPass);

View File

@ -271,7 +271,8 @@ bool GrTessellatingPathRenderer::onDrawPath(const DrawPathArgs& args) {
vmi.mapRect(&clipBounds);
SkPath path;
args.fShape->asPath(&path);
SkAutoTUnref<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fColor, *args.fShape,
SkAutoTUnref<GrDrawBatch> batch(TessellatingPathBatch::Create(args.fPaint->getColor(),
*args.fShape,
*args.fViewMatrix, clipBounds));
GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->mustUseHWAA(*args.fPaint));

View File

@ -246,7 +246,6 @@ static void test_path(GrDrawContext* drawContext, GrResourceProvider* rp, const
args.fDrawContext = drawContext;
args.fClip = &noClip;
args.fResourceProvider = rp;
args.fColor = GrColor_WHITE;
args.fViewMatrix = &SkMatrix::I();
GrShape shape(path, style);
args.fShape = &shape;