From ae3d63ad906021b6ca27f0737addc62034457ff0 Mon Sep 17 00:00:00 2001 From: joshualitt Date: Mon, 13 Jul 2015 08:44:06 -0700 Subject: ovals now take a const GrPipelineBuilder BUG=skia: Review URL: https://codereview.chromium.org/1232163002 --- src/gpu/GrDrawContext.cpp | 8 ++++---- src/gpu/GrOvalRenderer.cpp | 40 +++++++++++++++++++--------------------- src/gpu/GrOvalRenderer.h | 12 ++++++------ 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp index 2f04a02651..77a18677a6 100644 --- a/src/gpu/GrDrawContext.cpp +++ b/src/gpu/GrDrawContext.cpp @@ -893,7 +893,7 @@ void GrDrawContext::drawRRect(GrRenderTarget*rt, GrPipelineBuilder pipelineBuilder(paint, rt, clip); GrColor color = paint.getColor(); if (!GrOvalRenderer::DrawRRect(fDrawTarget, - &pipelineBuilder, + pipelineBuilder, color, viewMatrix, paint.isAntiAlias(), @@ -928,7 +928,7 @@ void GrDrawContext::drawDRRect(GrRenderTarget* rt, GrPipelineBuilder pipelineBuilder(paint, rt, clip); GrColor color = paint.getColor(); if (!GrOvalRenderer::DrawDRRect(fDrawTarget, - &pipelineBuilder, + pipelineBuilder, color, viewMatrix, paint.isAntiAlias(), @@ -975,7 +975,7 @@ void GrDrawContext::drawOval(GrRenderTarget* rt, GrPipelineBuilder pipelineBuilder(paint, rt, clip); GrColor color = paint.getColor(); if (!GrOvalRenderer::DrawOval(fDrawTarget, - &pipelineBuilder, + pipelineBuilder, color, viewMatrix, paint.isAntiAlias(), @@ -1085,7 +1085,7 @@ void GrDrawContext::drawPath(GrRenderTarget* rt, if (isOval && !path.isInverseFillType()) { if (GrOvalRenderer::DrawOval(fDrawTarget, - &pipelineBuilder, + pipelineBuilder, color, viewMatrix, paint.isAntiAlias(), diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp index a34027cd1d..89f6f5b15d 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -593,14 +593,13 @@ GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(GrProcessorTestData* d) { /////////////////////////////////////////////////////////////////////////////// bool GrOvalRenderer::DrawOval(GrDrawTarget* target, - GrPipelineBuilder* pipelineBuilder, + const GrPipelineBuilder& pipelineBuilder, GrColor color, const SkMatrix& viewMatrix, bool useAA, const SkRect& oval, - const SkStrokeRec& stroke) -{ - bool useCoverageAA = useAA && !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled(); + const SkStrokeRec& stroke) { + bool useCoverageAA = useAA && !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); if (!useCoverageAA) { return false; @@ -824,7 +823,7 @@ static GrBatch* create_circle_batch(GrColor color, } void GrOvalRenderer::DrawCircle(GrDrawTarget* target, - GrPipelineBuilder* pipelineBuilder, + const GrPipelineBuilder& pipelineBuilder, GrColor color, const SkMatrix& viewMatrix, bool useCoverageAA, @@ -832,7 +831,7 @@ void GrOvalRenderer::DrawCircle(GrDrawTarget* target, const SkStrokeRec& stroke) { SkAutoTUnref batch(create_circle_batch(color, viewMatrix, useCoverageAA, circle, stroke)); - target->drawBatch(*pipelineBuilder, batch); + target->drawBatch(pipelineBuilder, batch); } /////////////////////////////////////////////////////////////////////////////// @@ -1080,7 +1079,7 @@ static GrBatch* create_ellipse_batch(GrColor color, } bool GrOvalRenderer::DrawEllipse(GrDrawTarget* target, - GrPipelineBuilder* pipelineBuilder, + const GrPipelineBuilder& pipelineBuilder, GrColor color, const SkMatrix& viewMatrix, bool useCoverageAA, @@ -1092,7 +1091,7 @@ bool GrOvalRenderer::DrawEllipse(GrDrawTarget* target, return false; } - target->drawBatch(*pipelineBuilder, batch); + target->drawBatch(pipelineBuilder, batch); return true; } @@ -1325,7 +1324,7 @@ static GrBatch* create_diellipse_batch(GrColor color, } bool GrOvalRenderer::DrawDIEllipse(GrDrawTarget* target, - GrPipelineBuilder* pipelineBuilder, + const GrPipelineBuilder& pipelineBuilder, GrColor color, const SkMatrix& viewMatrix, bool useCoverageAA, @@ -1336,7 +1335,7 @@ bool GrOvalRenderer::DrawDIEllipse(GrDrawTarget* target, if (!batch) { return false; } - target->drawBatch(*pipelineBuilder, batch); + target->drawBatch(pipelineBuilder, batch); return true; } @@ -1384,14 +1383,13 @@ static const GrIndexBuffer* ref_rrect_index_buffer(bool strokeOnly, } bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target, - GrPipelineBuilder* pipelineBuilder, + const GrPipelineBuilder& pipelineBuilder, GrColor color, const SkMatrix& viewMatrix, bool useAA, const SkRRect& origOuter, const SkRRect& origInner) { - bool applyAA = useAA && - !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled(); + bool applyAA = useAA && !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; if (!origInner.isEmpty()) { SkTCopyOnFirstWrite inner(origInner); @@ -1408,8 +1406,8 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target, if (NULL == fp) { return false; } - arfp.set(pipelineBuilder); - pipelineBuilder->addCoverageProcessor(fp)->unref(); + arfp.set(&pipelineBuilder); + arfp.addCoverageProcessor(fp)->unref(); } SkStrokeRec fillRec(SkStrokeRec::kFill_InitStyle); @@ -1431,7 +1429,7 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target, return false; } if (!arfp.isSet()) { - arfp.set(pipelineBuilder); + arfp.set(&pipelineBuilder); } SkMatrix invert; @@ -1439,12 +1437,12 @@ bool GrOvalRenderer::DrawDRRect(GrDrawTarget* target, return false; } - pipelineBuilder->addCoverageProcessor(effect)->unref(); + arfp.addCoverageProcessor(effect)->unref(); SkRect bounds = outer->getBounds(); 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; } @@ -1952,7 +1950,7 @@ static GrBatch* create_rrect_batch(GrColor color, } bool GrOvalRenderer::DrawRRect(GrDrawTarget* target, - GrPipelineBuilder* pipelineBuilder, + const GrPipelineBuilder& pipelineBuilder, GrColor color, const SkMatrix& viewMatrix, bool useAA, @@ -1963,7 +1961,7 @@ bool GrOvalRenderer::DrawRRect(GrDrawTarget* target, stroke); } - bool useCoverageAA = useAA && !pipelineBuilder->getRenderTarget()->isUnifiedMultisampled(); + bool useCoverageAA = useAA && !pipelineBuilder.getRenderTarget()->isUnifiedMultisampled(); // only anti-aliased rrects for now if (!useCoverageAA) { @@ -1979,7 +1977,7 @@ bool GrOvalRenderer::DrawRRect(GrDrawTarget* target, return false; } - target->drawBatch(*pipelineBuilder, batch); + target->drawBatch(pipelineBuilder, batch); return true; } diff --git a/src/gpu/GrOvalRenderer.h b/src/gpu/GrOvalRenderer.h index d8d9e0c806..d591ffeed3 100644 --- a/src/gpu/GrOvalRenderer.h +++ b/src/gpu/GrOvalRenderer.h @@ -21,21 +21,21 @@ class SkStrokeRec; class GrOvalRenderer { public: static bool DrawOval(GrDrawTarget*, - GrPipelineBuilder*, + const GrPipelineBuilder&, GrColor, const SkMatrix& viewMatrix, bool useAA, const SkRect& oval, const SkStrokeRec& stroke); static bool DrawRRect(GrDrawTarget*, - GrPipelineBuilder*, + const GrPipelineBuilder&, GrColor, const SkMatrix& viewMatrix, bool useAA, const SkRRect& rrect, const SkStrokeRec& stroke); static bool DrawDRRect(GrDrawTarget* target, - GrPipelineBuilder*, + const GrPipelineBuilder&, GrColor, const SkMatrix& viewMatrix, bool useAA, @@ -46,21 +46,21 @@ private: GrOvalRenderer(); static bool DrawEllipse(GrDrawTarget* target, - GrPipelineBuilder*, + const GrPipelineBuilder&, GrColor, const SkMatrix& viewMatrix, bool useCoverageAA, const SkRect& ellipse, const SkStrokeRec& stroke); static bool DrawDIEllipse(GrDrawTarget* target, - GrPipelineBuilder*, + const GrPipelineBuilder&, GrColor, const SkMatrix& viewMatrix, bool useCoverageAA, const SkRect& ellipse, const SkStrokeRec& stroke); static void DrawCircle(GrDrawTarget* target, - GrPipelineBuilder*, + const GrPipelineBuilder&, GrColor, const SkMatrix& viewMatrix, bool useCoverageAA, -- cgit v1.2.3