Rename testingOnly_drawBatch to testingOnly_addDrawOp and sk_sp

Change-Id: I35efd4ad2b7132145c1e477f0b1f283276e9fad5
Reviewed-on: https://skia-review.googlesource.com/5704
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2016-12-09 16:07:12 -05:00 committed by Skia Commit-Bot
parent b0b17d1e53
commit 1951f3ddbd
11 changed files with 54 additions and 53 deletions

View File

@ -192,11 +192,12 @@ protected:
GrPaint grPaint;
grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc));
sk_sp<GrDrawOp> batch = sk_make_sp<BezierCubicOrConicTestBatch>(
gp, bounds, color, klmEqs, klmSigns[c]);
sk_sp<GrDrawOp> op = sk_make_sp<BezierCubicOrConicTestBatch>(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<GrDrawOp> batch(
new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, 1.f));
sk_sp<GrDrawOp> 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<GrDrawOp> batch(new BezierQuadTestBatch(gp, bounds, color, DevToUV));
sk_sp<GrDrawOp> 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) {

View File

@ -87,11 +87,11 @@ protected:
SkRect bounds = testBounds;
bounds.offset(SkIntToScalar(x), SkIntToScalar(y));
sk_sp<GrDrawOp> batch(
sk_sp<GrDrawOp> 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;

View File

@ -109,11 +109,11 @@ protected:
grPaint.addColorFragmentProcessor(std::move(fp));
sk_sp<GrDrawOp> batch(
sk_sp<GrDrawOp> 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.

View File

@ -183,10 +183,10 @@ protected:
grPaint.setXPFactory(GrPorterDuffXPFactory::Make(SkBlendMode::kSrc));
grPaint.addCoverageFragmentProcessor(std::move(fp));
sk_sp<GrDrawOp> batch(new PolyBoundsBatch(p.getBounds(), 0xff000000));
sk_sp<GrDrawOp> 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<GrDrawOp> batch(new PolyBoundsBatch(rect, 0xff000000));
sk_sp<GrDrawOp> 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);
}

View File

@ -115,12 +115,12 @@ protected:
SkRect bounds = rrect.getBounds();
bounds.outset(2.f, 2.f);
sk_sp<GrDrawOp> batch(
sk_sp<GrDrawOp> 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;
}

View File

@ -126,11 +126,11 @@ protected:
const SkMatrix viewMatrix = SkMatrix::MakeTrans(x, y);
grPaint.addColorFragmentProcessor(std::move(fp));
sk_sp<GrDrawOp> batch(
sk_sp<GrDrawOp> 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;

View File

@ -123,11 +123,11 @@ protected:
SkMatrix viewMatrix;
viewMatrix.setTranslate(x, y);
grPaint.addColorFragmentProcessor(std::move(fp));
sk_sp<GrDrawOp> batch(
sk_sp<GrDrawOp> 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<GrDrawOp> batch(GrRectBatchFactory::CreateNonAAFill(
sk_sp<GrDrawOp> 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));
}
}
}

View File

@ -108,9 +108,9 @@ public:
return fRenderTargetContext->fRenderTargetProxy->uniqueID();
}
void testingOnly_drawBatch(const GrPaint&,
void testingOnly_addDrawOp(const GrPaint&,
GrAAType,
GrDrawOp* batch,
sk_sp<GrDrawOp>,
const GrUserStencilSettings* = nullptr,
bool snapToCenters = false);

View File

@ -327,8 +327,8 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
GrPaint grPaint;
sk_sp<GrDrawOp> batch(GrRandomDrawBatch(&random, context));
SkASSERT(batch);
sk_sp<GrDrawOp> 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<GrDrawOp> batch(GrRandomDrawBatch(&random, context));
SkASSERT(batch);
sk_sp<GrDrawOp> 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();
}
}

View File

@ -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<GrDrawOp> batch;
sk_sp<GrDrawOp> 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);

View File

@ -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<GrDrawOp> 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