Rename files, macros, types, and functions related to GrDrawOp testing.
Make the test factories use sk_sp.
Change-Id: Idba630b84deb2848f2203a80fd72e1efa5fc6acf
Reviewed-on: https://skia-review.googlesource.com/6342
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrBatchTest.cpp b/src/gpu/GrBatchTest.cpp
deleted file mode 100644
index 562c569..0000000
--- a/src/gpu/GrBatchTest.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "GrBatchTest.h"
-#include "SkRandom.h"
-#include "SkTypes.h"
-
-#ifdef GR_TEST_UTILS
-
-DRAW_BATCH_TEST_EXTERN(AAConvexPathOp);
-DRAW_BATCH_TEST_EXTERN(AADistanceFieldPathOp);
-DRAW_BATCH_TEST_EXTERN(AAFillRectOp);
-DRAW_BATCH_TEST_EXTERN(AAFillRectOpLocalMatrix);
-DRAW_BATCH_TEST_EXTERN(AAFlatteningConvexPathOp)
-DRAW_BATCH_TEST_EXTERN(AAHairlineOp);
-DRAW_BATCH_TEST_EXTERN(AAStrokeRectOp);
-DRAW_BATCH_TEST_EXTERN(AnalyticRectOp);
-DRAW_BATCH_TEST_EXTERN(DashOp);
-DRAW_BATCH_TEST_EXTERN(DefaultPathOp);
-DRAW_BATCH_TEST_EXTERN(CircleOp);
-DRAW_BATCH_TEST_EXTERN(DIEllipseOp);
-DRAW_BATCH_TEST_EXTERN(EllipseOp);
-DRAW_BATCH_TEST_EXTERN(GrDrawAtlasOp);
-DRAW_BATCH_TEST_EXTERN(NonAAStrokeRectOp);
-DRAW_BATCH_TEST_EXTERN(PLSPathOp);
-DRAW_BATCH_TEST_EXTERN(RRectOp);
-DRAW_BATCH_TEST_EXTERN(TesselatingPathOp);
-DRAW_BATCH_TEST_EXTERN(TextBlobBatch);
-DRAW_BATCH_TEST_EXTERN(VerticesOp);
-
-static BatchTestFunc gTestBatches[] = {
- DRAW_BATCH_TEST_ENTRY(AAConvexPathOp),
- DRAW_BATCH_TEST_ENTRY(AADistanceFieldPathOp),
- DRAW_BATCH_TEST_ENTRY(AAFillRectOp),
- DRAW_BATCH_TEST_ENTRY(AAFillRectOpLocalMatrix),
- DRAW_BATCH_TEST_ENTRY(AAFlatteningConvexPathOp),
- DRAW_BATCH_TEST_ENTRY(AAHairlineOp),
- DRAW_BATCH_TEST_ENTRY(AAStrokeRectOp),
- DRAW_BATCH_TEST_ENTRY(AnalyticRectOp),
- DRAW_BATCH_TEST_ENTRY(DashOp),
- DRAW_BATCH_TEST_ENTRY(DefaultPathOp),
- DRAW_BATCH_TEST_ENTRY(CircleOp),
- DRAW_BATCH_TEST_ENTRY(DIEllipseOp),
- DRAW_BATCH_TEST_ENTRY(EllipseOp),
- DRAW_BATCH_TEST_ENTRY(GrDrawAtlasOp),
- DRAW_BATCH_TEST_ENTRY(NonAAStrokeRectOp),
- // This currently hits an assert when the GrDisableColorXPFactory is randomly selected.
- // DRAW_BATCH_TEST_ENTRY(PLSPathOp),
- DRAW_BATCH_TEST_ENTRY(RRectOp),
- DRAW_BATCH_TEST_ENTRY(TesselatingPathOp),
- DRAW_BATCH_TEST_ENTRY(TextBlobBatch),
- DRAW_BATCH_TEST_ENTRY(VerticesOp)
-};
-
-GrDrawOp* GrRandomDrawBatch(SkRandom* random, GrContext* context) {
- uint32_t index = random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gTestBatches)));
- BatchTestFunc func = gTestBatches[index];
- return (*func)(random, context);
-}
-#endif
diff --git a/src/gpu/GrBatchTest.h b/src/gpu/GrBatchTest.h
deleted file mode 100644
index 5d7fa63..0000000
--- a/src/gpu/GrBatchTest.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrBatchTest_DEFINED
-#define GrBatchTest_DEFINED
-
-#include "GrTestUtils.h"
-
-#ifdef GR_TEST_UTILS
-
-class GrDrawOp;
-class GrContext;
-class SkRandom;
-
-/*
- * This file defines some macros for testing batches, and also declares functions / objects which
- * are generally useful for GrOp testing
- */
-
-// Batches should define test functions using DRAW_BATCH_TEST_DEFINE. The other macros defined
-// below are used exclusively by the test harness.
-typedef GrDrawOp* (*BatchTestFunc)(SkRandom* random, GrContext* context);
-#define DRAW_BATCH_TEST_DEFINE(Batch) \
- GrDrawOp* Batch##__Test(SkRandom* random, GrContext* context)
-#define DRAW_BATCH_TEST_EXTERN(Batch) \
- extern GrDrawOp* Batch##__Test(SkRandom*, GrContext* context);
-#define DRAW_BATCH_TEST_ENTRY(Batch) \
- Batch##__Test
-#define DRAW_BATCH_TEST_FRIEND(Batch) \
- friend GrDrawOp* Batch##__Test(SkRandom* random, GrContext* context);
-
-GrDrawOp* GrRandomDrawBatch(SkRandom*, GrContext*);
-
-#endif
-#endif
diff --git a/src/gpu/GrDrawOpTest.cpp b/src/gpu/GrDrawOpTest.cpp
new file mode 100644
index 0000000..bb26acc
--- /dev/null
+++ b/src/gpu/GrDrawOpTest.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrDrawOpTest.h"
+#include "ops/GrDrawOp.h"
+#include "SkRandom.h"
+#include "SkTypes.h"
+
+#ifdef GR_TEST_UTILS
+
+#define DRAW_OP_TEST_EXTERN(Op) extern sk_sp<GrDrawOp> Op##__Test(SkRandom*, GrContext* context);
+
+#define DRAW_OP_TEST_ENTRY(Op) Op##__Test
+
+DRAW_OP_TEST_EXTERN(AAConvexPathOp);
+DRAW_OP_TEST_EXTERN(AADistanceFieldPathOp);
+DRAW_OP_TEST_EXTERN(AAFillRectOp);
+DRAW_OP_TEST_EXTERN(AAFillRectOpLocalMatrix);
+DRAW_OP_TEST_EXTERN(AAFlatteningConvexPathOp)
+DRAW_OP_TEST_EXTERN(AAHairlineOp);
+DRAW_OP_TEST_EXTERN(AAStrokeRectOp);
+DRAW_OP_TEST_EXTERN(AnalyticRectOp);
+DRAW_OP_TEST_EXTERN(DashOp);
+DRAW_OP_TEST_EXTERN(DefaultPathOp);
+DRAW_OP_TEST_EXTERN(CircleOp);
+DRAW_OP_TEST_EXTERN(DIEllipseOp);
+DRAW_OP_TEST_EXTERN(EllipseOp);
+DRAW_OP_TEST_EXTERN(GrDrawAtlasOp);
+DRAW_OP_TEST_EXTERN(NonAAStrokeRectOp);
+DRAW_OP_TEST_EXTERN(PLSPathOp);
+DRAW_OP_TEST_EXTERN(RRectOp);
+DRAW_OP_TEST_EXTERN(TesselatingPathOp);
+DRAW_OP_TEST_EXTERN(TextBlobOp);
+DRAW_OP_TEST_EXTERN(VerticesOp);
+
+sk_sp<GrDrawOp> GrRandomDrawOp(SkRandom* random, GrContext* context) {
+ using MakeTestDrawOpFn = sk_sp<GrDrawOp>(SkRandom* random, GrContext* context);
+ static constexpr MakeTestDrawOpFn* gFactories[] = {
+ DRAW_OP_TEST_ENTRY(AAConvexPathOp),
+ DRAW_OP_TEST_ENTRY(AADistanceFieldPathOp),
+ DRAW_OP_TEST_ENTRY(AAFillRectOp),
+ DRAW_OP_TEST_ENTRY(AAFillRectOpLocalMatrix),
+ DRAW_OP_TEST_ENTRY(AAFlatteningConvexPathOp),
+ DRAW_OP_TEST_ENTRY(AAHairlineOp),
+ DRAW_OP_TEST_ENTRY(AAStrokeRectOp),
+ DRAW_OP_TEST_ENTRY(AnalyticRectOp),
+ DRAW_OP_TEST_ENTRY(DashOp),
+ DRAW_OP_TEST_ENTRY(DefaultPathOp),
+ DRAW_OP_TEST_ENTRY(CircleOp),
+ DRAW_OP_TEST_ENTRY(DIEllipseOp),
+ DRAW_OP_TEST_ENTRY(EllipseOp),
+ DRAW_OP_TEST_ENTRY(GrDrawAtlasOp),
+ DRAW_OP_TEST_ENTRY(NonAAStrokeRectOp),
+ // This currently hits an assert when the GrDisableColorXPFactory is randomly selected.
+ // DRAW_OP_TEST_ENTRY(PLSPathOp),
+ DRAW_OP_TEST_ENTRY(RRectOp),
+ DRAW_OP_TEST_ENTRY(TesselatingPathOp),
+ DRAW_OP_TEST_ENTRY(TextBlobOp),
+ DRAW_OP_TEST_ENTRY(VerticesOp)
+ };
+
+ uint32_t index = random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gFactories)));
+ return gFactories[index](random, context);
+}
+#endif
diff --git a/src/gpu/GrDrawOpTest.h b/src/gpu/GrDrawOpTest.h
new file mode 100644
index 0000000..0d88a40
--- /dev/null
+++ b/src/gpu/GrDrawOpTest.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrDrawOpTest_DEFINED
+#define GrDrawOpTest_DEFINED
+
+#include "GrTestUtils.h"
+#include "SkRefCnt.h"
+
+#ifdef GR_TEST_UTILS
+
+class GrDrawOp;
+class GrContext;
+class SkRandom;
+
+/** This function returns a randomly configured GrDrawOp for testing purposes. */
+sk_sp<GrDrawOp> GrRandomDrawOp(SkRandom*, GrContext*);
+
+/** GrDrawOp subclasses should define test factory functions using this macro. */
+#define DRAW_OP_TEST_DEFINE(Op) sk_sp<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context)
+
+/** This macro may be used if the test factory function must be made a friend of a class. */
+#define DRAW_OP_TEST_FRIEND(Op) \
+ friend sk_sp<GrDrawOp> Op##__Test(SkRandom* random, GrContext* context);
+
+#endif
+#endif
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 60a213f..10881de 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -5,16 +5,16 @@
* found in the LICENSE file.
*/
-#include "GrBatchTest.h"
-#include "GrColor.h"
#include "GrRenderTargetContext.h"
-#include "GrRenderTargetContextPriv.h"
+#include "GrColor.h"
+#include "GrDrawOpTest.h"
#include "GrDrawingManager.h"
#include "GrFixedClip.h"
#include "GrGpuResourcePriv.h"
#include "GrPathRenderer.h"
#include "GrPipelineBuilder.h"
#include "GrRenderTarget.h"
+#include "GrRenderTargetContextPriv.h"
#include "GrRenderTargetPriv.h"
#include "GrResourceProvider.h"
#include "SkSurfacePriv.h"
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index 40f4284..fd4083b 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -8,10 +8,10 @@
#include "GrAAConvexPathRenderer.h"
#include "GrAAConvexTessellator.h"
-#include "GrBatchTest.h"
#include "GrCaps.h"
#include "GrContext.h"
#include "GrDefaultGeoProcFactory.h"
+#include "GrDrawOpTest.h"
#include "GrGeometryProcessor.h"
#include "GrInvariantOutput.h"
#include "GrOpFlushState.h"
@@ -1007,12 +1007,12 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(AAConvexPathOp) {
+DRAW_OP_TEST_DEFINE(AAConvexPathOp) {
GrColor color = GrRandomColor(random);
SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
SkPath path = GrTest::TestPathConvex(random);
- return AAConvexPathOp::Make(color, viewMatrix, path).release();
+ return AAConvexPathOp::Make(color, viewMatrix, path);
}
#endif
diff --git a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
index 678c920..00d3ed7 100644
--- a/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/ops/GrAADistanceFieldPathRenderer.cpp
@@ -7,9 +7,9 @@
#include "GrAADistanceFieldPathRenderer.h"
-#include "GrBatchTest.h"
#include "GrBuffer.h"
#include "GrContext.h"
+#include "GrDrawOpTest.h"
#include "GrOpFlushState.h"
#include "GrPipelineBuilder.h"
#include "GrResourceProvider.h"
@@ -581,7 +581,7 @@
ShapeDataList fShapeList;
};
-DRAW_BATCH_TEST_DEFINE(AADistanceFieldPathOp) {
+DRAW_OP_TEST_DEFINE(AADistanceFieldPathOp) {
static PathTestStruct gTestStruct;
if (context->uniqueID() != gTestStruct.fContextID) {
@@ -608,8 +608,7 @@
gTestStruct.fAtlas.get(),
&gTestStruct.fShapeCache,
&gTestStruct.fShapeList,
- gammaCorrect)
- .release();
+ gammaCorrect);
}
#endif
diff --git a/src/gpu/ops/GrAAFillRectOp.cpp b/src/gpu/ops/GrAAFillRectOp.cpp
index 9f7b0e0..d45954c 100644
--- a/src/gpu/ops/GrAAFillRectOp.cpp
+++ b/src/gpu/ops/GrAAFillRectOp.cpp
@@ -386,23 +386,23 @@
#ifdef GR_TEST_UTILS
-#include "GrBatchTest.h"
+#include "GrDrawOpTest.h"
-DRAW_BATCH_TEST_DEFINE(AAFillRectOp) {
+DRAW_OP_TEST_DEFINE(AAFillRectOp) {
GrColor color = GrRandomColor(random);
SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
SkRect rect = GrTest::TestRect(random);
SkRect devRect = GrTest::TestRect(random);
- return GrAAFillRectOp::Make(color, viewMatrix, rect, devRect).release();
+ return GrAAFillRectOp::Make(color, viewMatrix, rect, devRect);
}
-DRAW_BATCH_TEST_DEFINE(AAFillRectOpLocalMatrix) {
+DRAW_OP_TEST_DEFINE(AAFillRectOpLocalMatrix) {
GrColor color = GrRandomColor(random);
SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
SkMatrix localMatrix = GrTest::TestMatrix(random);
SkRect rect = GrTest::TestRect(random);
SkRect devRect = GrTest::TestRect(random);
- return GrAAFillRectOp::Make(color, viewMatrix, localMatrix, rect, devRect).release();
+ return GrAAFillRectOp::Make(color, viewMatrix, localMatrix, rect, devRect);
}
#endif
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index 7707afa..b5a7978 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -7,11 +7,11 @@
#include "GrAAHairLinePathRenderer.h"
-#include "GrBatchTest.h"
#include "GrBuffer.h"
#include "GrCaps.h"
#include "GrContext.h"
#include "GrDefaultGeoProcFactory.h"
+#include "GrDrawOpTest.h"
#include "GrOpFlushState.h"
#include "GrPathUtils.h"
#include "GrPipelineBuilder.h"
@@ -972,14 +972,13 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(AAHairlineOp) {
+DRAW_OP_TEST_DEFINE(AAHairlineOp) {
GrColor color = GrRandomColor(random);
SkMatrix viewMatrix = GrTest::TestMatrix(random);
SkPath path = GrTest::TestPath(random);
SkIRect devClipBounds;
devClipBounds.setEmpty();
- return AAHairlineOp::Make(color, viewMatrix, path, GrStyle::SimpleHairline(), devClipBounds)
- .release();
+ return AAHairlineOp::Make(color, viewMatrix, path, GrStyle::SimpleHairline(), devClipBounds);
}
#endif
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index c247353..8f2ab86 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -8,9 +8,9 @@
#include "GrAALinearizingConvexPathRenderer.h"
#include "GrAAConvexTessellator.h"
-#include "GrBatchTest.h"
#include "GrContext.h"
#include "GrDefaultGeoProcFactory.h"
+#include "GrDrawOpTest.h"
#include "GrGeometryProcessor.h"
#include "GrInvariantOutput.h"
#include "GrOpFlushState.h"
@@ -374,7 +374,7 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathOp) {
+DRAW_OP_TEST_DEFINE(AAFlatteningConvexPathOp) {
GrColor color = GrRandomColor(random);
SkMatrix viewMatrix = GrTest::TestMatrixPreservesRightAngles(random);
SkPath path = GrTest::TestPathConvex(random);
@@ -400,8 +400,7 @@
}
return AAFlatteningConvexPathOp::Make(color, viewMatrix, path, strokeWidth, style, join,
- miterLimit)
- .release();
+ miterLimit);
}
#endif
diff --git a/src/gpu/ops/GrAAStrokeRectOp.cpp b/src/gpu/ops/GrAAStrokeRectOp.cpp
index 2528892..5660679 100644
--- a/src/gpu/ops/GrAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrAAStrokeRectOp.cpp
@@ -587,9 +587,9 @@
#ifdef GR_TEST_UTILS
-#include "GrBatchTest.h"
+#include "GrDrawOpTest.h"
-DRAW_BATCH_TEST_DEFINE(AAStrokeRectOp) {
+DRAW_OP_TEST_DEFINE(AAStrokeRectOp) {
bool miterStroke = random->nextBool();
// Create either a empty rect or a non-empty rect.
@@ -605,7 +605,7 @@
rec.setStrokeParams(SkPaint::kButt_Cap,
miterStroke ? SkPaint::kMiter_Join : SkPaint::kBevel_Join, 1.f);
SkMatrix matrix = GrTest::TestMatrixRectStaysRect(random);
- return GrAAStrokeRectOp::Make(color, matrix, rect, rec).release();
+ return GrAAStrokeRectOp::Make(color, matrix, rect, rec);
}
#endif
diff --git a/src/gpu/ops/GrAnalyticRectOp.cpp b/src/gpu/ops/GrAnalyticRectOp.cpp
index 63e1548..9c4e66c 100644
--- a/src/gpu/ops/GrAnalyticRectOp.cpp
+++ b/src/gpu/ops/GrAnalyticRectOp.cpp
@@ -7,7 +7,7 @@
#include "GrAnalyticRectOp.h"
-#include "GrBatchTest.h"
+#include "GrDrawOpTest.h"
#include "GrGeometryProcessor.h"
#include "GrInvariantOutput.h"
#include "GrOpFlushState.h"
@@ -390,13 +390,13 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(AnalyticRectOp) {
+DRAW_OP_TEST_DEFINE(AnalyticRectOp) {
SkMatrix viewMatrix = GrTest::TestMatrix(random);
GrColor color = GrRandomColor(random);
SkRect rect = GrTest::TestSquare(random);
SkRect croppedRect = GrTest::TestSquare(random);
SkRect bounds = GrTest::TestSquare(random);
- return new AnalyticRectOp(color, viewMatrix, rect, croppedRect, bounds);
+ return sk_sp<GrDrawOp>(new AnalyticRectOp(color, viewMatrix, rect, croppedRect, bounds));
}
#endif
diff --git a/src/gpu/ops/GrDashOp.cpp b/src/gpu/ops/GrDashOp.cpp
index 9218482..8052795 100644
--- a/src/gpu/ops/GrDashOp.cpp
+++ b/src/gpu/ops/GrDashOp.cpp
@@ -7,11 +7,11 @@
#include "GrDashOp.h"
-#include "GrBatchTest.h"
#include "GrCaps.h"
#include "GrContext.h"
#include "GrCoordTransform.h"
#include "GrDefaultGeoProcFactory.h"
+#include "GrDrawOpTest.h"
#include "GrGeometryProcessor.h"
#include "GrInvariantOutput.h"
#include "GrOpFlushState.h"
@@ -1210,7 +1210,7 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(DashOp) {
+DRAW_OP_TEST_DEFINE(DashOp) {
GrColor color = GrRandomColor(random);
SkMatrix viewMatrix = GrTest::TestMatrixPreservesRightAngles(random);
AAMode aaMode = static_cast<AAMode>(random->nextULessThan(GrDashOp::kAAModeCnt));
@@ -1275,7 +1275,7 @@
GrStyle style(p);
- return GrDashOp::MakeDashLineOp(color, viewMatrix, pts, aaMode, style).release();
+ return GrDashOp::MakeDashLineOp(color, viewMatrix, pts, aaMode, style);
}
#endif
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index b979d91..4803c0d 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -7,9 +7,9 @@
#include "GrDefaultPathRenderer.h"
-#include "GrBatchTest.h"
#include "GrContext.h"
#include "GrDefaultGeoProcFactory.h"
+#include "GrDrawOpTest.h"
#include "GrFixedClip.h"
#include "GrMesh.h"
#include "GrOpFlushState.h"
@@ -618,7 +618,7 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(DefaultPathOp) {
+DRAW_OP_TEST_DEFINE(DefaultPathOp) {
GrColor color = GrRandomColor(random);
SkMatrix viewMatrix = GrTest::TestMatrix(random);
@@ -634,8 +634,7 @@
viewMatrix.mapRect(&bounds);
uint8_t coverage = GrRandomCoverage(random);
- return DefaultPathOp::Make(color, path, srcSpaceTol, coverage, viewMatrix, true, bounds)
- .release();
+ return DefaultPathOp::Make(color, path, srcSpaceTol, coverage, viewMatrix, true, bounds);
}
#endif
diff --git a/src/gpu/ops/GrDrawAtlasOp.cpp b/src/gpu/ops/GrDrawAtlasOp.cpp
index 3dafbda..e01ad73 100644
--- a/src/gpu/ops/GrDrawAtlasOp.cpp
+++ b/src/gpu/ops/GrDrawAtlasOp.cpp
@@ -6,7 +6,7 @@
*/
#include "GrDrawAtlasOp.h"
-#include "GrBatchTest.h"
+#include "GrDrawOpTest.h"
#include "GrOpFlushState.h"
#include "SkGr.h"
#include "SkRSXform.h"
@@ -235,7 +235,7 @@
}
}
-DRAW_BATCH_TEST_DEFINE(GrDrawAtlasOp) {
+DRAW_OP_TEST_DEFINE(GrDrawAtlasOp) {
uint32_t spriteCount = random->nextRangeU(1, 100);
SkTArray<SkRSXform> xforms(spriteCount);
@@ -250,8 +250,7 @@
GrColor color = GrRandomColor(random);
return GrDrawAtlasOp::Make(color, viewMatrix, spriteCount, xforms.begin(), texRects.begin(),
- hasColors ? colors.begin() : nullptr)
- .release();
+ hasColors ? colors.begin() : nullptr);
}
#endif
diff --git a/src/gpu/ops/GrDrawVerticesOp.cpp b/src/gpu/ops/GrDrawVerticesOp.cpp
index 37be6d0..c6ae1c1 100644
--- a/src/gpu/ops/GrDrawVerticesOp.cpp
+++ b/src/gpu/ops/GrDrawVerticesOp.cpp
@@ -213,7 +213,7 @@
#ifdef GR_TEST_UTILS
-#include "GrBatchTest.h"
+#include "GrDrawOpTest.h"
static uint32_t seed_vertices(GrPrimitiveType type) {
switch (type) {
@@ -274,7 +274,7 @@
}
}
-DRAW_BATCH_TEST_DEFINE(VerticesOp) {
+DRAW_OP_TEST_DEFINE(VerticesOp) {
GrPrimitiveType type = GrPrimitiveType(random->nextULessThan(kLast_GrPrimitiveType + 1));
uint32_t primitiveCount = random->nextRangeU(1, 100);
@@ -312,8 +312,7 @@
GrColor color = GrRandomColor(random);
return GrDrawVerticesOp::Make(color, type, viewMatrix, positions.begin(), vertexCount,
indices.begin(), hasIndices ? vertexCount : 0, colors.begin(),
- texCoords.begin(), bounds)
- .release();
+ texCoords.begin(), bounds);
}
#endif
diff --git a/src/gpu/ops/GrNonAAFillRectOp.cpp b/src/gpu/ops/GrNonAAFillRectOp.cpp
index de000e2..e672985 100644
--- a/src/gpu/ops/GrNonAAFillRectOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectOp.cpp
@@ -203,9 +203,9 @@
#ifdef GR_TEST_UTILS
-#include "GrBatchTest.h"
+#include "GrDrawOpTest.h"
-DRAW_BATCH_TEST_DEFINE(NonAAFillRectOp) {
+DRAW_OP_TEST_DEFINE(NonAAFillRectOp) {
GrColor color = GrRandomColor(random);
SkRect rect = GrTest::TestRect(random);
SkRect localRect = GrTest::TestRect(random);
@@ -218,8 +218,7 @@
viewMatrix,
rect,
hasLocalRect ? &localRect : nullptr,
- hasLocalMatrix ? &localMatrix : nullptr)
- .release();
+ hasLocalMatrix ? &localMatrix : nullptr);
}
#endif
diff --git a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
index 443c511..fde4328 100644
--- a/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectPerspectiveOp.cpp
@@ -246,9 +246,9 @@
#ifdef GR_TEST_UTILS
-#include "GrBatchTest.h"
+#include "GrDrawOpTest.h"
-DRAW_BATCH_TEST_DEFINE(NonAAFillRectPerspectiveOp) {
+DRAW_OP_TEST_DEFINE(NonAAFillRectPerspectiveOp) {
GrColor color = GrRandomColor(random);
SkRect rect = GrTest::TestRect(random);
SkRect localRect = GrTest::TestRect(random);
@@ -263,8 +263,7 @@
bool hasLocalRect = random->nextBool();
return GrNonAAFillRectOp::MakeWithPerspective(color, viewMatrix, rect,
hasLocalRect ? &localRect : nullptr,
- hasLocalMatrix ? &localMatrix : nullptr)
- .release();
+ hasLocalMatrix ? &localMatrix : nullptr);
}
#endif
diff --git a/src/gpu/ops/GrNonAAStrokeRectOp.cpp b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
index b74cd50..065f08a 100644
--- a/src/gpu/ops/GrNonAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
@@ -7,9 +7,9 @@
#include "GrNonAAStrokeRectOp.h"
-#include "GrBatchTest.h"
#include "GrColor.h"
#include "GrDefaultGeoProcFactory.h"
+#include "GrDrawOpTest.h"
#include "GrMeshDrawOp.h"
#include "GrOpFlushState.h"
#include "SkRandom.h"
@@ -198,7 +198,7 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(NonAAStrokeRectOp) {
+DRAW_OP_TEST_DEFINE(NonAAStrokeRectOp) {
SkMatrix viewMatrix = GrTest::TestMatrix(random);
GrColor color = GrRandomColor(random);
SkRect rect = GrTest::TestRect(random);
@@ -208,8 +208,7 @@
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeJoin(SkPaint::kMiter_Join);
SkStrokeRec strokeRec(paint);
- return GrNonAAStrokeRectOp::Make(color, viewMatrix, rect, strokeRec, random->nextBool())
- .release();
+ return GrNonAAStrokeRectOp::Make(color, viewMatrix, rect, strokeRec, random->nextBool());
}
#endif
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index 7a53ca6..10fc375 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -7,7 +7,7 @@
#include "GrOvalOpFactory.h"
-#include "GrBatchTest.h"
+#include "GrDrawOpTest.h"
#include "GrGeometryProcessor.h"
#include "GrInvariantOutput.h"
#include "GrOpFlushState.h"
@@ -2425,7 +2425,7 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(CircleOp) {
+DRAW_OP_TEST_DEFINE(CircleOp) {
do {
SkScalar rotate = random->nextSScalar1() * 360.f;
SkScalar translateX = random->nextSScalar1() * 1000.f;
@@ -2451,32 +2451,31 @@
sk_sp<GrDrawOp> op = CircleOp::Make(color, viewMatrix, center, radius,
GrStyle(stroke, nullptr), arcParams);
if (op) {
- return op.release();
+ return op;
}
} while (true);
}
-DRAW_BATCH_TEST_DEFINE(EllipseOp) {
+DRAW_OP_TEST_DEFINE(EllipseOp) {
SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
GrColor color = GrRandomColor(random);
SkRect ellipse = GrTest::TestSquare(random);
- return EllipseOp::Make(color, viewMatrix, ellipse, GrTest::TestStrokeRec(random)).release();
+ return EllipseOp::Make(color, viewMatrix, ellipse, GrTest::TestStrokeRec(random));
}
-DRAW_BATCH_TEST_DEFINE(DIEllipseOp) {
+DRAW_OP_TEST_DEFINE(DIEllipseOp) {
SkMatrix viewMatrix = GrTest::TestMatrix(random);
GrColor color = GrRandomColor(random);
SkRect ellipse = GrTest::TestSquare(random);
- return DIEllipseOp::Make(color, viewMatrix, ellipse, GrTest::TestStrokeRec(random)).release();
+ return DIEllipseOp::Make(color, viewMatrix, ellipse, GrTest::TestStrokeRec(random));
}
-DRAW_BATCH_TEST_DEFINE(RRectOp) {
+DRAW_OP_TEST_DEFINE(RRectOp) {
SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
GrColor color = GrRandomColor(random);
const SkRRect& rrect = GrTest::TestRRectSimple(random);
bool needsDistance = random->nextBool();
- return make_rrect_op(color, needsDistance, viewMatrix, rrect, GrTest::TestStrokeRec(random))
- .release();
+ return make_rrect_op(color, needsDistance, viewMatrix, rrect, GrTest::TestStrokeRec(random));
}
#endif
diff --git a/src/gpu/ops/GrPLSPathRenderer.cpp b/src/gpu/ops/GrPLSPathRenderer.cpp
index 38b3075..e4d11de 100644
--- a/src/gpu/ops/GrPLSPathRenderer.cpp
+++ b/src/gpu/ops/GrPLSPathRenderer.cpp
@@ -7,10 +7,10 @@
#include "GrPLSPathRenderer.h"
-#include "GrBatchTest.h"
#include "GrCaps.h"
#include "GrContext.h"
#include "GrDefaultGeoProcFactory.h"
+#include "GrDrawOpTest.h"
#include "GrInvariantOutput.h"
#include "GrOpFlushState.h"
#include "GrPLSGeometryProcessor.h"
@@ -948,12 +948,12 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(PLSPathOp) {
+DRAW_OP_TEST_DEFINE(PLSPathOp) {
GrColor color = GrRandomColor(random);
SkMatrix vm = GrTest::TestMatrixInvertible(random);
SkPath path = GrTest::TestPathConvex(random);
- return PLSPathOp::Make(color, path, vm).release();
+ return PLSPathOp::Make(color, path, vm);
}
#endif
diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp
index e099edb..302f174 100755
--- a/src/gpu/ops/GrShadowRRectOp.cpp
+++ b/src/gpu/ops/GrShadowRRectOp.cpp
@@ -7,7 +7,7 @@
#include "GrShadowRRectOp.h"
-#include "GrBatchTest.h"
+#include "GrDrawOpTest.h"
#include "GrOpFlushState.h"
#include "GrResourceProvider.h"
#include "GrStyle.h"
@@ -931,7 +931,7 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(ShadowCircleOp) {
+DRAW_OP_TEST_DEFINE(ShadowCircleOp) {
do {
SkScalar rotate = random->nextSScalar1() * 360.f;
SkScalar translateX = random->nextSScalar1() * 1000.f;
@@ -950,19 +950,18 @@
sk_sp<GrDrawOp> op = ShadowCircleOp::Make(color, viewMatrix, center, radius, blurRadius,
GrStyle(stroke, nullptr));
if (op) {
- return op.release();
+ return op;
}
} while (true);
}
-DRAW_BATCH_TEST_DEFINE(ShadowRRectOp) {
+DRAW_OP_TEST_DEFINE(ShadowRRectOp) {
SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random);
GrColor color = GrRandomColor(random);
const SkRRect& rrect = GrTest::TestRRectSimple(random);
SkScalar blurRadius = random->nextSScalar1() * 72.f;
return make_shadow_rrect_batch(color, viewMatrix, rrect, blurRadius,
- GrTest::TestStrokeRec(random))
- .release();
+ GrTest::TestStrokeRec(random));
}
#endif
diff --git a/src/gpu/ops/GrTessellatingPathRenderer.cpp b/src/gpu/ops/GrTessellatingPathRenderer.cpp
index 5f6eb58..1de24da 100644
--- a/src/gpu/ops/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/ops/GrTessellatingPathRenderer.cpp
@@ -8,9 +8,9 @@
#include "GrTessellatingPathRenderer.h"
#include "GrAuditTrail.h"
-#include "GrBatchTest.h"
#include "GrClip.h"
#include "GrDefaultGeoProcFactory.h"
+#include "GrDrawOpTest.h"
#include "GrMesh.h"
#include "GrOpFlushState.h"
#include "GrPathUtils.h"
@@ -376,7 +376,7 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(TesselatingPathOp) {
+DRAW_OP_TEST_DEFINE(TesselatingPathOp) {
GrColor color = GrRandomColor(random);
SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random);
SkPath path = GrTest::TestPath(random);
@@ -389,7 +389,7 @@
GrTest::TestStyle(random, &style);
} while (!style.isSimpleFill());
GrShape shape(path, style);
- return TessellatingPathOp::Make(color, shape, viewMatrix, devClipBounds, antiAlias).release();
+ return TessellatingPathOp::Make(color, shape, viewMatrix, devClipBounds, antiAlias);
}
#endif
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index 032a983..e1a3675 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -376,7 +376,7 @@
#ifdef GR_TEST_UTILS
-DRAW_BATCH_TEST_DEFINE(TextBlobBatch) {
+DRAW_OP_TEST_DEFINE(TextBlobOp) {
static uint32_t gContextID = SK_InvalidGenID;
static GrAtlasTextContext* gTextContext = nullptr;
static SkSurfaceProps gSurfaceProps(SkSurfaceProps::kLegacyFontHost_InitType);
@@ -419,19 +419,14 @@
// right now we don't handle textblobs, nor do we handle drawPosText. Since we only
// intend to test the batch with this unit test, that is okay.
- sk_sp<GrAtlasTextBlob> blob(
- GrAtlasTextContext::CreateDrawTextBlob(context->getTextBlobCache(),
- context->getAtlasGlyphCache(),
- *context->caps()->shaderCaps(), grPaint, skPaint,
- GrAtlasTextContext::kTextBlobBatchScalerContextFlags,
- viewMatrix,
- gSurfaceProps, text,
- static_cast<size_t>(textLen), x, y));
+ sk_sp<GrAtlasTextBlob> blob(GrAtlasTextContext::CreateDrawTextBlob(
+ context->getTextBlobCache(), context->getAtlasGlyphCache(),
+ *context->caps()->shaderCaps(), grPaint, skPaint,
+ GrAtlasTextContext::kTextBlobOpScalerContextFlags, viewMatrix, gSurfaceProps, text,
+ static_cast<size_t>(textLen), x, y));
- return blob
- ->test_makeOp(textLen, 0, 0, viewMatrix, x, y, color, skPaint, gSurfaceProps,
- gTextContext->dfAdjustTable(), context->getAtlasGlyphCache())
- .release();
+ return blob->test_makeOp(textLen, 0, 0, viewMatrix, x, y, color, skPaint, gSurfaceProps,
+ gTextContext->dfAdjustTable(), context->getAtlasGlyphCache());
}
#endif
diff --git a/src/gpu/text/GrAtlasTextContext.h b/src/gpu/text/GrAtlasTextContext.h
index 471d9d2..0417935 100644
--- a/src/gpu/text/GrAtlasTextContext.h
+++ b/src/gpu/text/GrAtlasTextContext.h
@@ -14,7 +14,7 @@
#include "SkTextBlobRunIterator.h"
#ifdef GR_TEST_UTILS
-#include "GrBatchTest.h"
+#include "GrDrawOpTest.h"
#endif
class GrDrawOp;
@@ -89,9 +89,9 @@
sk_sp<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
#ifdef GR_TEST_UTILS
- static const uint32_t kTextBlobBatchScalerContextFlags =
- SkPaint::kFakeGammaAndBoostContrast_ScalerContextFlags;
- DRAW_BATCH_TEST_FRIEND(TextBlobBatch);
+ static const uint32_t kTextBlobOpScalerContextFlags =
+ SkPaint::kFakeGammaAndBoostContrast_ScalerContextFlags;
+ DRAW_OP_TEST_FRIEND(TextBlobOp);
#endif
};