From 1951f3ddbddcf5e7cdfe151981d13a1bdb6a3baa Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Fri, 9 Dec 2016 16:07:12 -0500 Subject: [PATCH] Rename testingOnly_drawBatch to testingOnly_addDrawOp and sk_sp Change-Id: I35efd4ad2b7132145c1e477f0b1f283276e9fad5 Reviewed-on: https://skia-review.googlesource.com/5704 Reviewed-by: Brian Osman Commit-Queue: Brian Salomon --- gm/beziereffects.cpp | 23 ++++++++++++----------- gm/bigrrectaaeffect.cpp | 6 +++--- gm/constcolorprocessor.cpp | 6 +++--- gm/convexpolyeffect.cpp | 12 ++++++------ gm/rrects.cpp | 6 +++--- gm/texturedomaineffect.cpp | 6 +++--- gm/yuvtorgbeffect.cpp | 12 ++++++------ src/gpu/GrRenderTargetContextPriv.h | 4 ++-- tests/GLProgramsTest.cpp | 14 +++++++------- tests/PrimitiveProcessorTest.cpp | 10 +++++----- tools/gpu/GrTest.cpp | 8 ++++---- 11 files changed, 54 insertions(+), 53 deletions(-) diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp index 9a1990b383..73af7e45b8 100644 --- a/gm/beziereffects.cpp +++ b/gm/beziereffects.cpp @@ -192,11 +192,12 @@ protected: GrPaint grPaint; grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc)); - sk_sp batch = sk_make_sp( - gp, bounds, color, klmEqs, klmSigns[c]); + sk_sp op = sk_make_sp(gp, bounds, color, + klmEqs, + klmSigns[c]); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, - batch.get()); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, + std::move(op)); } ++col; if (numCols == col) { @@ -325,11 +326,11 @@ protected: GrPaint grPaint; grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc)); - sk_sp batch( - new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, 1.f)); + sk_sp op(new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, + 1.f)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, - batch.get()); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, + std::move(op)); } ++col; if (numCols == col) { @@ -538,10 +539,10 @@ protected: GrPathUtils::QuadUVMatrix DevToUV(pts); - sk_sp batch(new BezierQuadTestBatch(gp, bounds, color, DevToUV)); + sk_sp op(new BezierQuadTestBatch(gp, bounds, color, DevToUV)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, - batch.get()); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, + std::move(op)); } ++col; if (numCols == col) { diff --git a/gm/bigrrectaaeffect.cpp b/gm/bigrrectaaeffect.cpp index 9750d90197..8921a1477e 100644 --- a/gm/bigrrectaaeffect.cpp +++ b/gm/bigrrectaaeffect.cpp @@ -87,11 +87,11 @@ protected: SkRect bounds = testBounds; bounds.offset(SkIntToScalar(x), SkIntToScalar(y)); - sk_sp batch( + sk_sp op( GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(), bounds, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, - batch.get()); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, + std::move(op)); } canvas->restore(); x = x + fTestOffsetX; diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp index 67b2b33e19..60f90a590a 100644 --- a/gm/constcolorprocessor.cpp +++ b/gm/constcolorprocessor.cpp @@ -109,11 +109,11 @@ protected: grPaint.addColorFragmentProcessor(std::move(fp)); - sk_sp batch( + sk_sp op( GrRectBatchFactory::CreateNonAAFill(grPaint.getColor(), viewMatrix, renderRect, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, - batch.get()); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, + std::move(op)); // Draw labels for the input to the processor and the processor to the right of // the test rect. The input label appears above the processor label. diff --git a/gm/convexpolyeffect.cpp b/gm/convexpolyeffect.cpp index c7a5d0c7f1..9903c39b93 100644 --- a/gm/convexpolyeffect.cpp +++ b/gm/convexpolyeffect.cpp @@ -183,10 +183,10 @@ protected: grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc)); grPaint.addCoverageFragmentProcessor(std::move(fp)); - sk_sp batch(new PolyBoundsBatch(p.getBounds(), 0xff000000)); + sk_sp op(new PolyBoundsBatch(p.getBounds(), 0xff000000)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, - batch.get()); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, + std::move(op)); x += SkScalarCeilToScalar(path->getBounds().width() + kDX); } @@ -223,10 +223,10 @@ protected: grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc)); grPaint.addCoverageFragmentProcessor(std::move(fp)); - sk_sp batch(new PolyBoundsBatch(rect, 0xff000000)); + sk_sp op(new PolyBoundsBatch(rect, 0xff000000)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, - batch.get()); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, + std::move(op)); x += SkScalarCeilToScalar(rect.width() + kDX); } diff --git a/gm/rrects.cpp b/gm/rrects.cpp index a3b31d55ca..43b06eb473 100644 --- a/gm/rrects.cpp +++ b/gm/rrects.cpp @@ -115,12 +115,12 @@ protected: SkRect bounds = rrect.getBounds(); bounds.outset(2.f, 2.f); - sk_sp batch( + sk_sp op( GrRectBatchFactory::CreateNonAAFill(0xff000000, SkMatrix::I(), bounds, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, - batch.get()); + std::move(op)); } else { drew = false; } diff --git a/gm/texturedomaineffect.cpp b/gm/texturedomaineffect.cpp index a3176ad7e7..882f14d89b 100644 --- a/gm/texturedomaineffect.cpp +++ b/gm/texturedomaineffect.cpp @@ -126,11 +126,11 @@ protected: const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y); grPaint.addColorFragmentProcessor(std::move(fp)); - sk_sp batch( + sk_sp op( GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, - batch.get()); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, + std::move(op)); x += renderRect.width() + kTestPad; } y += renderRect.height() + kTestPad; diff --git a/gm/yuvtorgbeffect.cpp b/gm/yuvtorgbeffect.cpp index d4539ea71c..168571c914 100644 --- a/gm/yuvtorgbeffect.cpp +++ b/gm/yuvtorgbeffect.cpp @@ -123,11 +123,11 @@ protected: SkMatrix viewMatrix; viewMatrix.setTranslate(x, y); grPaint.addColorFragmentProcessor(std::move(fp)); - sk_sp batch( + sk_sp op( GrRectBatchFactory::CreateNonAAFill(GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, - batch.get()); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, + std::move(op)); } x += renderRect.width() + kTestPad; } @@ -237,10 +237,10 @@ protected: SkMatrix viewMatrix; viewMatrix.setTranslate(x, y); grPaint.addColorFragmentProcessor(fp); - sk_sp batch(GrRectBatchFactory::CreateNonAAFill( + sk_sp op(GrRectBatchFactory::CreateNonAAFill( GrColor_WHITE, viewMatrix, renderRect, nullptr, nullptr)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, - batch.get()); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, + std::move(op)); } } } diff --git a/src/gpu/GrRenderTargetContextPriv.h b/src/gpu/GrRenderTargetContextPriv.h index d53bd5634b..b3bd72a563 100644 --- a/src/gpu/GrRenderTargetContextPriv.h +++ b/src/gpu/GrRenderTargetContextPriv.h @@ -108,9 +108,9 @@ public: return fRenderTargetContext->fRenderTargetProxy->uniqueID(); } - void testingOnly_drawBatch(const GrPaint&, + void testingOnly_addDrawOp(const GrPaint&, GrAAType, - GrDrawOp* batch, + sk_sp, const GrUserStencilSettings* = nullptr, bool snapToCenters = false); diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index bddbee1bc4..3335237a17 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -327,8 +327,8 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { GrPaint grPaint; - sk_sp batch(GrRandomDrawBatch(&random, context)); - SkASSERT(batch); + sk_sp op(GrRandomDrawBatch(&random, context)); + SkASSERT(op); GrProcessorTestData ptd(&random, context, context->caps(), renderTargetContext.get(), dummyTextures); @@ -341,7 +341,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { static constexpr GrAAType kAATypes[] = {GrAAType::kNone, GrAAType::kCoverage}; GrAAType aaType = kAATypes[random.nextULessThan(SK_ARRAY_COUNT(kAATypes))]; - renderTargetContext->priv().testingOnly_drawBatch(grPaint, aaType, batch.get(), uss, + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, aaType, std::move(op), uss, snapToCenters); } // Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes) @@ -363,8 +363,8 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { for (int i = 0; i < fpFactoryCnt; ++i) { // Since FP factories internally randomize, call each 10 times. for (int j = 0; j < 10; ++j) { - sk_sp batch(GrRandomDrawBatch(&random, context)); - SkASSERT(batch); + sk_sp op(GrRandomDrawBatch(&random, context)); + SkASSERT(op); GrProcessorTestData ptd(&random, context, context->caps(), renderTargetContext.get(), dummyTextures); GrPaint grPaint; @@ -376,8 +376,8 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { BlockInputFragmentProcessor::Make(std::move(fp))); grPaint.addColorFragmentProcessor(std::move(blockFP)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, - batch.get()); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, + std::move(op)); drawingManager->flush(); } } diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp index 17ce369580..63740b45bb 100644 --- a/tests/PrimitiveProcessorTest.cpp +++ b/tests/PrimitiveProcessorTest.cpp @@ -123,11 +123,11 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0); #endif - sk_sp batch; + sk_sp op; GrPaint grPaint; // This one should succeed. - batch.reset(new Batch(attribCnt)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, batch.get()); + op.reset(new Batch(attribCnt)); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, std::move(op)); context->flush(); #if GR_GPU_STATS REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 1); @@ -135,8 +135,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { #endif context->resetGpuStats(); // This one should fail. - batch.reset(new Batch(attribCnt+1)); - renderTargetContext->priv().testingOnly_drawBatch(grPaint, GrAAType::kNone, batch.get()); + op.reset(new Batch(attribCnt+1)); + renderTargetContext->priv().testingOnly_addDrawOp(grPaint, GrAAType::kNone, std::move(op)); context->flush(); #if GR_GPU_STATS REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index 574cb0c2d3..a7feffc8f2 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -243,16 +243,16 @@ void GrResourceCache::changeTimestamp(uint32_t newTimestamp) { fTimestamp = newT SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fRenderTargetContext->fSingleOwner);) #define RETURN_IF_ABANDONED if (fRenderTargetContext->fDrawingManager->wasAbandoned()) { return; } -void GrRenderTargetContextPriv::testingOnly_drawBatch(const GrPaint& paint, +void GrRenderTargetContextPriv::testingOnly_addDrawOp(const GrPaint& paint, GrAAType aaType, - GrDrawOp* batch, + sk_sp op, const GrUserStencilSettings* uss, bool snapToCenters) { ASSERT_SINGLE_OWNER RETURN_IF_ABANDONED SkDEBUGCODE(fRenderTargetContext->validate();) GR_AUDIT_TRAIL_AUTO_FRAME(fRenderTargetContext->fAuditTrail, - "GrRenderTargetContext::testingOnly_drawBatch"); + "GrRenderTargetContext::testingOnly_addDrawOp"); GrPipelineBuilder pipelineBuilder(paint, aaType); if (uss) { @@ -263,7 +263,7 @@ void GrRenderTargetContextPriv::testingOnly_drawBatch(const GrPaint& paint, } fRenderTargetContext->getOpList()->addDrawOp(pipelineBuilder, fRenderTargetContext, GrNoClip(), - sk_ref_sp(batch)); + op); } #undef ASSERT_SINGLE_OWNER