• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
14 BATCH_TEST_EXTERN(AAConvexPathBatch);
15 BATCH_TEST_EXTERN(AADistanceFieldPathBatch);
16 BATCH_TEST_EXTERN(AAFillRectBatch);
17 BATCH_TEST_EXTERN(AAHairlineBatch);
18 BATCH_TEST_EXTERN(AAStrokeRectBatch);
19 BATCH_TEST_EXTERN(DashBatch);
20 BATCH_TEST_EXTERN(DefaultPathBatch);
21 BATCH_TEST_EXTERN(CircleBatch);
22 BATCH_TEST_EXTERN(DIEllipseBatch);
23 BATCH_TEST_EXTERN(EllipseBatch);
24 BATCH_TEST_EXTERN(RRectBatch);
25 BATCH_TEST_EXTERN(StrokeRectBatch);
26 BATCH_TEST_EXTERN(TesselatingPathBatch);
27 BATCH_TEST_EXTERN(TextBlobBatch);
28 BATCH_TEST_EXTERN(VerticesBatch);
29 
30 static BatchTestFunc gTestBatches[] = {
31     BATCH_TEST_ENTRY(AAConvexPathBatch),
32     BATCH_TEST_ENTRY(AADistanceFieldPathBatch),
33     BATCH_TEST_ENTRY(AAFillRectBatch),
34     BATCH_TEST_ENTRY(AAHairlineBatch),
35     BATCH_TEST_ENTRY(AAStrokeRectBatch),
36     BATCH_TEST_ENTRY(DashBatch),
37     BATCH_TEST_ENTRY(DefaultPathBatch),
38     BATCH_TEST_ENTRY(CircleBatch),
39     BATCH_TEST_ENTRY(DIEllipseBatch),
40     BATCH_TEST_ENTRY(EllipseBatch),
41     BATCH_TEST_ENTRY(RRectBatch),
42     BATCH_TEST_ENTRY(StrokeRectBatch),
43     BATCH_TEST_ENTRY(TesselatingPathBatch),
44     BATCH_TEST_ENTRY(TextBlobBatch),
45     BATCH_TEST_ENTRY(VerticesBatch)
46 };
47 
GrRandomBatch(SkRandom * random,GrContext * context)48 GrBatch* GrRandomBatch(SkRandom* random, GrContext* context) {
49     uint32_t index = random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gTestBatches)));
50     BatchTestFunc func = gTestBatches[index];
51     return (*func)(random, context);
52 }
53 #endif
54