From 73c4e64f4bb90059cf822dac9eaf30e1c38bec77 Mon Sep 17 00:00:00 2001 From: robertphillips Date: Wed, 2 Mar 2016 11:36:59 -0800 Subject: Retract GrDrawTarget and GrPipelineBuilder a bit more GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1761523002 NOTRY=true Review URL: https://codereview.chromium.org/1761523002 --- src/gpu/GrTracing.h | 3 +-- src/gpu/batches/GrDashLinePathRenderer.cpp | 15 +++++++++++++-- src/gpu/effects/GrDashingEffect.cpp | 21 +++++++-------------- src/gpu/effects/GrDashingEffect.h | 13 +++++++------ src/gpu/text/GrAtlasTextContext.cpp | 2 +- src/gpu/text/GrStencilAndCoverTextContext.cpp | 1 - src/gpu/text/GrStencilAndCoverTextContext.h | 2 +- 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/gpu/GrTracing.h b/src/gpu/GrTracing.h index 3dbc0ef17e..273aa65989 100644 --- a/src/gpu/GrTracing.h +++ b/src/gpu/GrTracing.h @@ -8,7 +8,6 @@ #ifndef GrTracing_DEFINED #define GrTracing_DEFINED -#include "GrDrawTarget.h" #include "GrGpu.h" #include "GrTraceMarker.h" #include "SkTLazy.h" @@ -19,7 +18,7 @@ */ class GrGpuTraceMarkerGenerator : public ::SkNoncopyable { public: - GrGpuTraceMarkerGenerator(GrDrawTarget* target) {} + GrGpuTraceMarkerGenerator() {} ~GrGpuTraceMarkerGenerator() { if (fTraceMarker.isValid()) { diff --git a/src/gpu/batches/GrDashLinePathRenderer.cpp b/src/gpu/batches/GrDashLinePathRenderer.cpp index 902dca6d86..9ee27c78dd 100644 --- a/src/gpu/batches/GrDashLinePathRenderer.cpp +++ b/src/gpu/batches/GrDashLinePathRenderer.cpp @@ -20,8 +20,19 @@ bool GrDashLinePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { bool GrDashLinePathRenderer::onDrawPath(const DrawPathArgs& args) { GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(), "GrDashLinePathRenderer::onDrawPath"); + bool msaaIsEnabled = args.fPipelineBuilder->getRenderTarget()->isUnifiedMultisampled(); SkPoint pts[2]; SkAssertResult(args.fPath->isLine(pts)); - return GrDashingEffect::DrawDashLine(args.fTarget, *args.fPipelineBuilder, args.fColor, - *args.fViewMatrix, pts, args.fAntiAlias, *args.fStroke); + SkAutoTUnref batch(GrDashingEffect::CreateDashLineBatch(args.fColor, + *args.fViewMatrix, + pts, + args.fAntiAlias, + msaaIsEnabled, + *args.fStroke)); + if (!batch) { + return false; + } + + args.fTarget->drawBatch(*args.fPipelineBuilder, batch); + return true; } diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index 17a2d8dfe7..13d4a38e85 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -14,7 +14,6 @@ #include "GrContext.h" #include "GrCoordTransform.h" #include "GrDefaultGeoProcFactory.h" -#include "GrDrawTarget.h" #include "GrInvariantOutput.h" #include "GrProcessor.h" #include "GrStrokeInfo.h" @@ -746,19 +745,13 @@ static GrDrawBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, cons return DashBatch::Create(geometry, cap, aaMode, fullDash); } -bool GrDashingEffect::DrawDashLine(GrDrawTarget* target, - const GrPipelineBuilder& pipelineBuilder, GrColor color, - const SkMatrix& viewMatrix, const SkPoint pts[2], - bool useAA, const GrStrokeInfo& strokeInfo) { - SkAutoTUnref batch( - create_batch(color, viewMatrix, pts, useAA, strokeInfo, - pipelineBuilder.getRenderTarget()->isUnifiedMultisampled())); - if (!batch) { - return false; - } - - target->drawBatch(pipelineBuilder, batch); - return true; +GrDrawBatch* GrDashingEffect::CreateDashLineBatch(GrColor color, + const SkMatrix& viewMatrix, + const SkPoint pts[2], + bool useAA, + bool msaaIsEnabled, + const GrStrokeInfo& strokeInfo) { + return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaIsEnabled); } ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrDashingEffect.h b/src/gpu/effects/GrDashingEffect.h index 7d0d006f1b..eaa0d0d5b5 100644 --- a/src/gpu/effects/GrDashingEffect.h +++ b/src/gpu/effects/GrDashingEffect.h @@ -14,15 +14,16 @@ #include "SkPathEffect.h" class GrClip; -class GrDrawTarget; -class GrPaint; -class GrPipelineBuilder; +class GrDrawBatch; class GrStrokeInfo; namespace GrDashingEffect { - bool DrawDashLine(GrDrawTarget*, const GrPipelineBuilder&, GrColor, - const SkMatrix& viewMatrix, const SkPoint pts[2], bool useAA, - const GrStrokeInfo& strokeInfo); + GrDrawBatch* CreateDashLineBatch(GrColor, + const SkMatrix& viewMatrix, + const SkPoint pts[2], + bool useAA, + bool msaaIsEnabled, + const GrStrokeInfo& strokeInfo); bool CanDrawDashLine(const SkPoint pts[2], const GrStrokeInfo& strokeInfo, const SkMatrix& viewMatrix); } diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp index 9cdd891b15..1a77810306 100644 --- a/src/gpu/text/GrAtlasTextContext.cpp +++ b/src/gpu/text/GrAtlasTextContext.cpp @@ -6,8 +6,8 @@ */ #include "GrAtlasTextContext.h" +#include "GrContext.h" #include "GrDrawContext.h" -#include "GrDrawTarget.h" #include "GrTextBlobCache.h" #include "GrTextUtils.h" diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp index 52281b2bbe..12b3f2f877 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.cpp +++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp @@ -8,7 +8,6 @@ #include "GrStencilAndCoverTextContext.h" #include "GrAtlasTextContext.h" #include "GrDrawContext.h" -#include "GrDrawTarget.h" #include "GrPath.h" #include "GrPathRange.h" #include "GrResourceProvider.h" diff --git a/src/gpu/text/GrStencilAndCoverTextContext.h b/src/gpu/text/GrStencilAndCoverTextContext.h index 892e279f59..b1faba11b0 100644 --- a/src/gpu/text/GrStencilAndCoverTextContext.h +++ b/src/gpu/text/GrStencilAndCoverTextContext.h @@ -8,7 +8,7 @@ #ifndef GrStencilAndCoverTextContext_DEFINED #define GrStencilAndCoverTextContext_DEFINED -#include "GrDrawTarget.h" +#include "GrDrawContext.h" #include "GrStrokeInfo.h" #include "SkDrawFilter.h" #include "SkTextBlob.h" -- cgit v1.2.3