blob: 344464d7170b156470c77cbdc1efe5bea8d793d2 [file] [log] [blame]
joshualitt3f655f32015-04-29 10:01:22 -07001/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "GrBatchTest.h"
9#include "SkRandom.h"
10#include "SkTypes.h"
11
12#ifdef GR_TEST_UTILS
13
bsalomonabd30f52015-08-13 13:34:48 -070014DRAW_BATCH_TEST_EXTERN(AAConvexPathBatch);
15DRAW_BATCH_TEST_EXTERN(AADistanceFieldPathBatch);
16DRAW_BATCH_TEST_EXTERN(AAFillRectBatch);
17DRAW_BATCH_TEST_EXTERN(AAFillRectBatchLocalMatrix);
18DRAW_BATCH_TEST_EXTERN(AAHairlineBatch);
19DRAW_BATCH_TEST_EXTERN(AAStrokeRectBatch);
20DRAW_BATCH_TEST_EXTERN(DashBatch);
21DRAW_BATCH_TEST_EXTERN(DefaultPathBatch);
22DRAW_BATCH_TEST_EXTERN(CircleBatch);
23DRAW_BATCH_TEST_EXTERN(DIEllipseBatch);
24DRAW_BATCH_TEST_EXTERN(EllipseBatch);
25DRAW_BATCH_TEST_EXTERN(GrDrawAtlasBatch);
joshualitt3566d442015-09-18 07:12:55 -070026DRAW_BATCH_TEST_EXTERN(NonAAStrokeRectBatch);
bsalomonabd30f52015-08-13 13:34:48 -070027DRAW_BATCH_TEST_EXTERN(RRectBatch);
28DRAW_BATCH_TEST_EXTERN(TesselatingPathBatch);
29DRAW_BATCH_TEST_EXTERN(TextBlobBatch);
30DRAW_BATCH_TEST_EXTERN(VerticesBatch);
joshualitt3f655f32015-04-29 10:01:22 -070031
32static BatchTestFunc gTestBatches[] = {
bsalomonabd30f52015-08-13 13:34:48 -070033 DRAW_BATCH_TEST_ENTRY(AAConvexPathBatch),
34 DRAW_BATCH_TEST_ENTRY(AADistanceFieldPathBatch),
35 DRAW_BATCH_TEST_ENTRY(AAFillRectBatch),
36 DRAW_BATCH_TEST_ENTRY(AAFillRectBatchLocalMatrix),
37 DRAW_BATCH_TEST_ENTRY(AAHairlineBatch),
38 DRAW_BATCH_TEST_ENTRY(AAStrokeRectBatch),
39 DRAW_BATCH_TEST_ENTRY(DashBatch),
40 DRAW_BATCH_TEST_ENTRY(DefaultPathBatch),
41 DRAW_BATCH_TEST_ENTRY(CircleBatch),
42 DRAW_BATCH_TEST_ENTRY(DIEllipseBatch),
43 DRAW_BATCH_TEST_ENTRY(EllipseBatch),
44 DRAW_BATCH_TEST_ENTRY(GrDrawAtlasBatch),
joshualitt3566d442015-09-18 07:12:55 -070045 DRAW_BATCH_TEST_ENTRY(NonAAStrokeRectBatch),
bsalomonabd30f52015-08-13 13:34:48 -070046 DRAW_BATCH_TEST_ENTRY(RRectBatch),
47 DRAW_BATCH_TEST_ENTRY(TesselatingPathBatch),
48 DRAW_BATCH_TEST_ENTRY(TextBlobBatch),
49 DRAW_BATCH_TEST_ENTRY(VerticesBatch)
joshualitt3f655f32015-04-29 10:01:22 -070050};
51
bsalomonabd30f52015-08-13 13:34:48 -070052GrDrawBatch* GrRandomDrawBatch(SkRandom* random, GrContext* context) {
joshualitt3f655f32015-04-29 10:01:22 -070053 uint32_t index = random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gTestBatches)));
54 BatchTestFunc func = gTestBatches[index];
55 return (*func)(random, context);
56}
57#endif