| Index: src/gpu/batches/GrMSAAPathRenderer.cpp
|
| diff --git a/src/gpu/batches/GrMSAAPathRenderer.cpp b/src/gpu/batches/GrMSAAPathRenderer.cpp
|
| index 2072175ef5ff55462f4b38dae6eec70581ee9c17..887c5273647822e5e6282018d2aa1fad9db80d40 100644
|
| --- a/src/gpu/batches/GrMSAAPathRenderer.cpp
|
| +++ b/src/gpu/batches/GrMSAAPathRenderer.cpp
|
| @@ -7,7 +7,9 @@
|
|
|
| #include "GrMSAAPathRenderer.h"
|
|
|
| +#include "GrAuditTrail.h"
|
| #include "GrBatchFlushState.h"
|
| +#include "GrClip.h"
|
| #include "GrDefaultGeoProcFactory.h"
|
| #include "GrPathStencilSettings.h"
|
| #include "GrPathUtils.h"
|
| @@ -566,19 +568,14 @@ private:
|
| typedef GrVertexBatch INHERITED;
|
| };
|
|
|
| -bool GrMSAAPathRenderer::internalDrawPath(GrDrawTarget* target,
|
| - GrPipelineBuilder* pipelineBuilder,
|
| +bool GrMSAAPathRenderer::internalDrawPath(GrDrawContext* drawContext,
|
| + const GrPaint& paint,
|
| + const GrUserStencilSettings* userStencilSettings,
|
| const GrClip& clip,
|
| GrColor color,
|
| const SkMatrix& viewMatrix,
|
| const SkPath& path,
|
| bool stencilOnly) {
|
| -
|
| - const GrXPFactory* xpFactory = pipelineBuilder->getXPFactory();
|
| - SkAutoTUnref<const GrXPFactory> backupXPFactory(SkSafeRef(xpFactory));
|
| - // face culling doesn't make sense here
|
| - SkASSERT(GrPipelineBuilder::kBoth_DrawFace == pipelineBuilder->getDrawFace());
|
| -
|
| int passCount = 0;
|
| const GrUserStencilSettings* passes[3];
|
| GrPipelineBuilder::DrawFace drawFace[3];
|
| @@ -643,21 +640,13 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawTarget* target,
|
| }
|
|
|
| SkRect devBounds;
|
| - GetPathDevBounds(path, pipelineBuilder->getRenderTarget(), viewMatrix, &devBounds);
|
| + GetPathDevBounds(path, drawContext->width(), drawContext->height(), viewMatrix, &devBounds);
|
|
|
| for (int p = 0; p < passCount; ++p) {
|
| - pipelineBuilder->setDrawFace(drawFace[p]);
|
| - if (passes[p]) {
|
| - pipelineBuilder->setUserStencil(passes[p]);
|
| - }
|
| -
|
| if (lastPassIsBounds && (p == passCount-1)) {
|
| - // Reset the XP Factory on pipelineBuilder
|
| - pipelineBuilder->setXPFactory(backupXPFactory);
|
| SkRect bounds;
|
| SkMatrix localMatrix = SkMatrix::I();
|
| if (reverse) {
|
| - SkASSERT(pipelineBuilder->getRenderTarget());
|
| // draw over the dev bounds (which will be the whole dst surface for inv fill).
|
| bounds = devBounds;
|
| SkMatrix vmi;
|
| @@ -677,12 +666,18 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawTarget* target,
|
| SkAutoTUnref<GrDrawBatch> batch(
|
| GrRectBatchFactory::CreateNonAAFill(color, viewM, bounds, nullptr,
|
| &localMatrix));
|
| - target->drawBatch(*pipelineBuilder, clip, batch);
|
| - } else {
|
| - if (passCount > 1) {
|
| - pipelineBuilder->setDisableColorXPFactory();
|
| +
|
| + GrPipelineBuilder pipelineBuilder(paint, drawContext->isUnifiedMultisampled());
|
| + pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget());
|
| + pipelineBuilder.setDrawFace(drawFace[p]);
|
| + if (passes[p]) {
|
| + pipelineBuilder.setUserStencil(passes[p]);
|
| + } else {
|
| + pipelineBuilder.setUserStencil(userStencilSettings);
|
| }
|
|
|
| + drawContext->drawBatch(pipelineBuilder, clip, batch);
|
| + } else {
|
| MSAAPathBatch::Geometry geometry;
|
| geometry.fColor = color;
|
| geometry.fPath = path;
|
| @@ -690,12 +685,23 @@ bool GrMSAAPathRenderer::internalDrawPath(GrDrawTarget* target,
|
|
|
| SkAutoTUnref<MSAAPathBatch> batch(MSAAPathBatch::Create(geometry, viewMatrix,
|
| devBounds));
|
| - if (batch->isValid()) {
|
| - target->drawBatch(*pipelineBuilder, clip, batch);
|
| - }
|
| - else {
|
| + if (!batch->isValid()) {
|
| return false;
|
| }
|
| +
|
| + GrPipelineBuilder pipelineBuilder(paint, drawContext->isUnifiedMultisampled());
|
| + pipelineBuilder.setRenderTarget(drawContext->accessRenderTarget());
|
| + pipelineBuilder.setDrawFace(drawFace[p]);
|
| + if (passes[p]) {
|
| + pipelineBuilder.setUserStencil(passes[p]);
|
| + } else {
|
| + pipelineBuilder.setUserStencil(userStencilSettings);
|
| + }
|
| + if (passCount > 1) {
|
| + pipelineBuilder.setDisableColorXPFactory();
|
| + }
|
| +
|
| + drawContext->drawBatch(pipelineBuilder, clip, batch);
|
| }
|
| }
|
| return true;
|
| @@ -711,7 +717,8 @@ bool GrMSAAPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
|
| }
|
|
|
| bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
| - GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(), "GrMSAAPathRenderer::onDrawPath");
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
|
| + "GrMSAAPathRenderer::onDrawPath");
|
| SkPath tmpPath;
|
| const SkPath* path;
|
| if (args.fStyle->applies()) {
|
| @@ -727,8 +734,9 @@ bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
| } else {
|
| path = args.fPath;
|
| }
|
| - return this->internalDrawPath(args.fTarget,
|
| - args.fPipelineBuilder,
|
| + return this->internalDrawPath(args.fDrawContext,
|
| + *args.fPaint,
|
| + args.fUserStencilSettings,
|
| *args.fClip,
|
| args.fColor,
|
| *args.fViewMatrix,
|
| @@ -737,11 +745,23 @@ bool GrMSAAPathRenderer::onDrawPath(const DrawPathArgs& args) {
|
| }
|
|
|
| void GrMSAAPathRenderer::onStencilPath(const StencilPathArgs& args) {
|
| - GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(),"GrMSAAPathRenderer::onStencilPath");
|
| + GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(),
|
| + "GrMSAAPathRenderer::onStencilPath");
|
| SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType());
|
| SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType());
|
| - this->internalDrawPath(args.fTarget, args.fPipelineBuilder, *args.fClip, GrColor_WHITE,
|
| - *args.fViewMatrix, *args.fPath, true);
|
| +
|
| + GrPaint paint;
|
| + paint.setXPFactory(GrDisableColorXPFactory::Create());
|
| + paint.setAntiAlias(args.fIsAA);
|
| +
|
| + this->internalDrawPath(args.fDrawContext,
|
| + paint,
|
| + &GrUserStencilSettings::kUnused,
|
| + *args.fClip,
|
| + GrColor_WHITE,
|
| + *args.fViewMatrix,
|
| + *args.fPath,
|
| + true);
|
| }
|
|
|
| ///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|