1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*
* 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 std::unique_ptr<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);
std::unique_ptr<GrDrawOp> GrRandomDrawOp(SkRandom* random, GrContext* context) {
using MakeTestDrawOpFn = std::unique_ptr<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
|