blob: faacf40b7dcbd7a9b1c69c2aa91d268a54ee37f0 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
2/*
3 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
reed@google.comd34658a2011-04-11 13:12:51 +00008#include "SkBenchmark.h"
9#include "SkBitmap.h"
10#include "SkCanvas.h"
11#include "SkColorPriv.h"
12#include "SkPaint.h"
tomhudson@google.com6e8d3352011-06-22 17:16:35 +000013#include "SkRandom.h"
reed@google.comd34658a2011-04-11 13:12:51 +000014#include "SkShader.h"
15#include "SkString.h"
bsalomon@google.com30e6d2c2012-08-13 14:03:31 +000016#include "SkTArray.h"
17
reed@google.comd34658a2011-04-11 13:12:51 +000018
19enum Flags {
20 kStroke_Flag = 1 << 0,
21 kBig_Flag = 1 << 1
22};
23
24#define FLAGS00 Flags(0)
25#define FLAGS01 Flags(kStroke_Flag)
26#define FLAGS10 Flags(kBig_Flag)
27#define FLAGS11 Flags(kStroke_Flag | kBig_Flag)
28
29class PathBench : public SkBenchmark {
30 SkPaint fPaint;
31 SkString fName;
32 Flags fFlags;
tomhudson@google.comca529d32011-10-28 15:34:49 +000033 enum { N = SkBENCHLOOP(1000) };
reed@google.comd34658a2011-04-11 13:12:51 +000034public:
35 PathBench(void* param, Flags flags) : INHERITED(param), fFlags(flags) {
36 fPaint.setStyle(flags & kStroke_Flag ? SkPaint::kStroke_Style :
37 SkPaint::kFill_Style);
38 fPaint.setStrokeWidth(SkIntToScalar(5));
39 fPaint.setStrokeJoin(SkPaint::kBevel_Join);
40 }
41
42 virtual void appendName(SkString*) = 0;
43 virtual void makePath(SkPath*) = 0;
tomhudson@google.com6e8d3352011-06-22 17:16:35 +000044 virtual int complexity() { return 0; }
reed@google.comd34658a2011-04-11 13:12:51 +000045
46protected:
bsalomon@google.com1647a192012-04-11 15:34:46 +000047 virtual const char* onGetName() SK_OVERRIDE {
reed@google.comd34658a2011-04-11 13:12:51 +000048 fName.printf("path_%s_%s_",
49 fFlags & kStroke_Flag ? "stroke" : "fill",
50 fFlags & kBig_Flag ? "big" : "small");
51 this->appendName(&fName);
52 return fName.c_str();
53 }
54
bsalomon@google.com1647a192012-04-11 15:34:46 +000055 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
reed@google.comd34658a2011-04-11 13:12:51 +000056 SkPaint paint(fPaint);
57 this->setupPaint(&paint);
58
59 SkPath path;
60 this->makePath(&path);
61 if (fFlags & kBig_Flag) {
62 SkMatrix m;
63 m.setScale(SkIntToScalar(10), SkIntToScalar(10));
64 path.transform(m);
65 }
66
67 int count = N;
68 if (fFlags & kBig_Flag) {
69 count >>= 2;
70 }
tomhudson@google.com6e8d3352011-06-22 17:16:35 +000071 count >>= (3 * complexity());
reed@google.comd34658a2011-04-11 13:12:51 +000072
73 for (int i = 0; i < count; i++) {
74 canvas->drawPath(path, paint);
75 }
76 }
77
78private:
79 typedef SkBenchmark INHERITED;
80};
81
82class TrianglePathBench : public PathBench {
83public:
84 TrianglePathBench(void* param, Flags flags) : INHERITED(param, flags) {}
85
bsalomon@google.com1647a192012-04-11 15:34:46 +000086 virtual void appendName(SkString* name) SK_OVERRIDE {
reed@google.comd34658a2011-04-11 13:12:51 +000087 name->append("triangle");
88 }
bsalomon@google.com1647a192012-04-11 15:34:46 +000089 virtual void makePath(SkPath* path) SK_OVERRIDE {
reed@google.comd34658a2011-04-11 13:12:51 +000090 static const int gCoord[] = {
91 10, 10, 15, 5, 20, 20
92 };
93 path->moveTo(SkIntToScalar(gCoord[0]), SkIntToScalar(gCoord[1]));
94 path->lineTo(SkIntToScalar(gCoord[2]), SkIntToScalar(gCoord[3]));
95 path->lineTo(SkIntToScalar(gCoord[4]), SkIntToScalar(gCoord[5]));
96 path->close();
97 }
98private:
99 typedef PathBench INHERITED;
100};
101
102class RectPathBench : public PathBench {
103public:
104 RectPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
105
bsalomon@google.com1647a192012-04-11 15:34:46 +0000106 virtual void appendName(SkString* name) SK_OVERRIDE {
reed@google.comd34658a2011-04-11 13:12:51 +0000107 name->append("rect");
108 }
bsalomon@google.com1647a192012-04-11 15:34:46 +0000109 virtual void makePath(SkPath* path) SK_OVERRIDE {
reed@google.comd34658a2011-04-11 13:12:51 +0000110 SkRect r = { 10, 10, 20, 20 };
111 path->addRect(r);
112 }
113private:
114 typedef PathBench INHERITED;
115};
116
117class OvalPathBench : public PathBench {
118public:
119 OvalPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
120
bsalomon@google.com1647a192012-04-11 15:34:46 +0000121 virtual void appendName(SkString* name) SK_OVERRIDE {
reed@google.comd34658a2011-04-11 13:12:51 +0000122 name->append("oval");
123 }
bsalomon@google.com1647a192012-04-11 15:34:46 +0000124 virtual void makePath(SkPath* path) SK_OVERRIDE {
reed@google.comd34658a2011-04-11 13:12:51 +0000125 SkRect r = { 10, 10, 20, 20 };
126 path->addOval(r);
127 }
128private:
129 typedef PathBench INHERITED;
130};
131
bsalomon@google.com1647a192012-04-11 15:34:46 +0000132class CirclePathBench: public PathBench {
133public:
134 CirclePathBench(void* param, Flags flags) : INHERITED(param, flags) {}
135
136 virtual void appendName(SkString* name) SK_OVERRIDE {
137 name->append("circle");
138 }
139 virtual void makePath(SkPath* path) SK_OVERRIDE {
140 path->addCircle(SkIntToScalar(20), SkIntToScalar(20),
141 SkIntToScalar(10));
142 }
143private:
144 typedef PathBench INHERITED;
145};
146
reed@google.comd34658a2011-04-11 13:12:51 +0000147class SawToothPathBench : public PathBench {
148public:
149 SawToothPathBench(void* param, Flags flags) : INHERITED(param, flags) {}
150
bsalomon@google.com1647a192012-04-11 15:34:46 +0000151 virtual void appendName(SkString* name) SK_OVERRIDE {
reed@google.comd34658a2011-04-11 13:12:51 +0000152 name->append("sawtooth");
153 }
154 virtual void makePath(SkPath* path) {
155 SkScalar x = SkIntToScalar(20);
156 SkScalar y = SkIntToScalar(20);
157 const SkScalar x0 = x;
158 const SkScalar dx = SK_Scalar1 * 5;
159 const SkScalar dy = SK_Scalar1 * 10;
160
161 path->moveTo(x, y);
162 for (int i = 0; i < 32; i++) {
163 x += dx;
164 path->lineTo(x, y - dy);
165 x += dx;
166 path->lineTo(x, y + dy);
167 }
168 path->lineTo(x, y + 2 * dy);
169 path->lineTo(x0, y + 2 * dy);
170 path->close();
171 }
bsalomon@google.com1647a192012-04-11 15:34:46 +0000172 virtual int complexity() SK_OVERRIDE { return 1; }
reed@google.comd34658a2011-04-11 13:12:51 +0000173private:
174 typedef PathBench INHERITED;
175};
176
tomhudson@google.com6e8d3352011-06-22 17:16:35 +0000177class LongCurvedPathBench : public PathBench {
178public:
179 LongCurvedPathBench(void * param, Flags flags)
180 : INHERITED(param, flags) {
181 }
182
bsalomon@google.com1647a192012-04-11 15:34:46 +0000183 virtual void appendName(SkString* name) SK_OVERRIDE {
tomhudson@google.com6e8d3352011-06-22 17:16:35 +0000184 name->append("long_curved");
185 }
bsalomon@google.com1647a192012-04-11 15:34:46 +0000186 virtual void makePath(SkPath* path) SK_OVERRIDE {
tomhudson@google.com6e8d3352011-06-22 17:16:35 +0000187 SkRandom rand (12);
188 int i;
189 for (i = 0; i < 100; i++) {
190 path->quadTo(SkScalarMul(rand.nextUScalar1(), SkIntToScalar(640)),
191 SkScalarMul(rand.nextUScalar1(), SkIntToScalar(480)),
192 SkScalarMul(rand.nextUScalar1(), SkIntToScalar(640)),
193 SkScalarMul(rand.nextUScalar1(), SkIntToScalar(480)));
194 }
195 path->close();
196 }
bsalomon@google.com1647a192012-04-11 15:34:46 +0000197 virtual int complexity() SK_OVERRIDE { return 2; }
tomhudson@google.com6e8d3352011-06-22 17:16:35 +0000198private:
199 typedef PathBench INHERITED;
200};
201
senorblanco@chromium.orge50f7362012-01-12 19:10:35 +0000202class LongLinePathBench : public PathBench {
203public:
204 LongLinePathBench(void * param, Flags flags)
205 : INHERITED(param, flags) {
206 }
207
bsalomon@google.com1647a192012-04-11 15:34:46 +0000208 virtual void appendName(SkString* name) SK_OVERRIDE {
senorblanco@chromium.orge50f7362012-01-12 19:10:35 +0000209 name->append("long_line");
210 }
bsalomon@google.com1647a192012-04-11 15:34:46 +0000211 virtual void makePath(SkPath* path) SK_OVERRIDE {
senorblanco@chromium.orge50f7362012-01-12 19:10:35 +0000212 SkRandom rand;
213 path->moveTo(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480);
214 for (size_t i = 1; i < 100; i++) {
215 path->lineTo(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480);
216 }
217 }
bsalomon@google.com1647a192012-04-11 15:34:46 +0000218 virtual int complexity() SK_OVERRIDE { return 2; }
senorblanco@chromium.orge50f7362012-01-12 19:10:35 +0000219private:
220 typedef PathBench INHERITED;
221};
tomhudson@google.com6e8d3352011-06-22 17:16:35 +0000222
bsalomon@google.com30e6d2c2012-08-13 14:03:31 +0000223class RandomPathBench : public SkBenchmark {
224public:
225 RandomPathBench(void* param) : INHERITED(param) {
226 }
227
228protected:
229 void createData(int minVerbs,
230 int maxVerbs,
231 int pathCnt,
232 bool allowMoves = true,
233 SkRect* bounds = NULL) {
234 SkRect tempBounds;
235 if (NULL == bounds) {
236 tempBounds.setXYWH(0, 0, SK_Scalar1, SK_Scalar1);
237 bounds = &tempBounds;
238 }
239 fVerbCnts.setReserve(pathCnt);
240 for (int i = 0; i < pathCnt; ++i) {
241 int vCount = fRandom.nextRangeU(minVerbs, maxVerbs + 1);
242 *fVerbCnts.append() = vCount;
243 for (int v = 0; v < vCount; ++v) {
244 int verb = fRandom.nextULessThan(SkPath::kDone_Verb);
245 if (SkPath::kMove_Verb == verb && !allowMoves) {
246 --v;
247 continue;
248 }
249 *fVerbs.append() = static_cast<SkPath::Verb>(verb);
250 static const int gPointCnt[] = {
251 1, // kMove
252 1, // kLine
253 2, // kQuad
254 3, // kCubic
255 0, // kClose
256 };
257 int pCnt = gPointCnt[verb];
258 for (int p = 0; p < pCnt; ++p) {
259 fPoints.append()->set(fRandom.nextRangeScalar(bounds->fLeft, bounds->fRight),
260 fRandom.nextRangeScalar(bounds->fTop, bounds->fBottom));
261 }
262 }
263 }
264 this->restartMakingPaths();
265 }
266
267 void restartMakingPaths() {
268 fCurrPath = 0;
269 fCurrVerb = 0;
270 fCurrPoint = 0;
271 }
272
273 void makePath(SkPath* path) {
274 int vCount = fVerbCnts[fCurrPath++];
275 for (int v = 0; v < vCount; ++v) {
276 switch (fVerbs[fCurrVerb++]) {
277 case SkPath::kMove_Verb:
278 path->moveTo(fPoints[fCurrPoint]);
279 ++fCurrPoint;
280 break;
281 case SkPath::kLine_Verb:
282 path->lineTo(fPoints[fCurrPoint]);
283 ++fCurrPoint;
284 break;
285 case SkPath::kQuad_Verb:
286 path->quadTo(fPoints[fCurrPoint], fPoints[fCurrPoint + 1]);
287 fCurrPoint += 2;
288 break;
289 case SkPath::kCubic_Verb:
290 path->cubicTo(fPoints[fCurrPoint],
291 fPoints[fCurrPoint + 1],
292 fPoints[fCurrPoint + 2]);
293 fCurrPoint += 3;
294 break;
295 case SkPath::kClose_Verb:
296 path->close();
297 break;
298 default:
299 SkDEBUGFAIL("Unexpected path verb");
300 break;
301 }
302 }
303 }
304
305 void finishedMakingPaths() {
306 fVerbCnts.reset();
307 fVerbs.reset();
308 fPoints.reset();
309 }
310
311private:
312 SkTDArray<int> fVerbCnts;
313 SkTDArray<SkPath::Verb> fVerbs;
314 SkTDArray<SkPoint> fPoints;
315 int fCurrPath;
316 int fCurrVerb;
317 int fCurrPoint;
318 SkRandom fRandom;
319 typedef SkBenchmark INHERITED;
320};
321
322class PathCreateBench : public RandomPathBench {
323public:
324 PathCreateBench(void* param) : INHERITED(param) {
325 }
326
327protected:
328 enum { N = SkBENCHLOOP(5000) };
329
330 virtual const char* onGetName() SK_OVERRIDE {
331 return "path_create";
332 }
333
334 virtual void onPreDraw() SK_OVERRIDE {
335 this->createData(10, 100, N);
336 SkASSERT(0 == fPaths.count());
337 fPaths.resize_back(N);
338 }
339
340 virtual void onDraw(SkCanvas*) SK_OVERRIDE {
341 for (int i = 0; i < N; ++i) {
342 this->makePath(&fPaths[i]);
343 }
344 this->restartMakingPaths();
345 }
346
347 virtual void onPostDraw() SK_OVERRIDE {
348 this->finishedMakingPaths();
349 fPaths.reset();
350 }
351
352private:
353 SkTArray<SkPath> fPaths;
354
355 typedef RandomPathBench INHERITED;
356};
357
358class PathCopyBench : public RandomPathBench {
359public:
360 PathCopyBench(void* param) : INHERITED(param) {
361 }
362
363protected:
bsalomon@google.com62e41902012-08-13 16:59:21 +0000364 enum { N = SkBENCHLOOP(30000) };
bsalomon@google.com30e6d2c2012-08-13 14:03:31 +0000365
366 virtual const char* onGetName() SK_OVERRIDE {
367 return "path_copy";
368 }
369 virtual void onPreDraw() SK_OVERRIDE {
370 this->createData(10, 100, N);
371 SkASSERT(0 == fPaths.count());
372 fPaths.resize_back(N);
373 fCopies.resize_back(N);
374 for (int i = 0; i < N; ++i) {
375 this->makePath(&fPaths[i]);
376 }
377 this->finishedMakingPaths();
378 }
379 virtual void onDraw(SkCanvas*) SK_OVERRIDE {
380 for (int i = 0; i < N; ++i) {
381 fCopies[i] = fPaths[i];
382 }
383 }
384 virtual void onPostDraw() SK_OVERRIDE {
385 fPaths.reset();
386 fCopies.reset();
387 }
388
389private:
390 SkTArray<SkPath> fPaths;
391 SkTArray<SkPath> fCopies;
392
393 typedef RandomPathBench INHERITED;
394};
395
396class PathTransformBench : public RandomPathBench {
397public:
398 PathTransformBench(bool inPlace, void* param)
399 : INHERITED(param)
400 , fInPlace(inPlace) {
401 }
402
403protected:
404 enum { N = SkBENCHLOOP(30000) };
405
406 virtual const char* onGetName() SK_OVERRIDE {
407 return fInPlace ? "path_transform_in_place" : "path_transform_copy";
408 }
409
410 virtual void onPreDraw() SK_OVERRIDE {
411 fMatrix.setScale(5 * SK_Scalar1, 6 * SK_Scalar1);
412 this->createData(10, 100, N);
413 SkASSERT(0 == fPaths.count());
414 SkASSERT(0 == fTransformed.count());
415 fPaths.resize_back(N);
416 for (int i = 0; i < N; ++i) {
417 this->makePath(&fPaths[i]);
418 }
419 if (!fInPlace) {
420 fTransformed.resize_back(N);
421 }
422 }
423
424 virtual void onDraw(SkCanvas*) SK_OVERRIDE {
425 if (fInPlace) {
426 for (int i = 0; i < N; ++i) {
427 fPaths[i].transform(fMatrix);
428 }
429 } else {
430 for (int i = 0; i < N; ++i) {
431 fPaths[i].transform(fMatrix, &fTransformed[i]);
432 }
433 }
434 }
435
436 virtual void onPostDraw() SK_OVERRIDE {
437 fPaths.reset();
438 fTransformed.reset();
439 }
440
441private:
442 SkTArray<SkPath> fPaths;
443 SkTArray<SkPath> fTransformed;
444 SkMatrix fMatrix;
445 bool fInPlace;
446 typedef RandomPathBench INHERITED;
447};
448
449class PathEqualityBench : public RandomPathBench {
450public:
451 PathEqualityBench(void* param)
452 : INHERITED(param) {
453 }
454
455protected:
456 enum { N = SkBENCHLOOP(40000) };
457
458 virtual const char* onGetName() SK_OVERRIDE {
459 return "path_equality_50%";
460 }
461
462 virtual void onPreDraw() SK_OVERRIDE {
463 fParity = 0;
464 this->createData(10, 100, N);
465 SkASSERT(0 == fPaths.count());
466 SkASSERT(0 == fCopies.count());
467 fPaths.resize_back(N);
468 fCopies.resize_back(N);
469 for (int i = 0; i < N; ++i) {
470 this->makePath(&fPaths[i]);
471 fCopies[i] = fPaths[i];
472 }
473 this->finishedMakingPaths();
474 }
475
476 virtual void onDraw(SkCanvas*) SK_OVERRIDE {
477 for (int i = 0; i < N; ++i) {
478 fParity ^= (fPaths[i] == fCopies[i & ~0x1]);
479 }
480 }
481
482 virtual void onPostDraw() SK_OVERRIDE {
483 fPaths.reset();
484 }
485
486private:
487 bool fParity; // attempt to keep compiler from optimizing out the ==
488 SkTArray<SkPath> fPaths;
489 SkTArray<SkPath> fCopies;
490 typedef RandomPathBench INHERITED;
491};
492
493class SkBench_AddPathTest : public RandomPathBench {
494public:
495 enum AddType {
496 kAdd_AddType,
497 kAddTrans_AddType,
498 kAddMatrix_AddType,
499 kPathTo_AddType,
500 kReverseAdd_AddType,
501 kReversePathTo_AddType,
502 };
503
504 SkBench_AddPathTest(AddType type, void* param)
505 : INHERITED(param)
506 , fType(type) {
507 fMatrix.setRotate(60 * SK_Scalar1);
508 }
509
510protected:
511 enum { N = SkBENCHLOOP(15000) };
512
513 virtual const char* onGetName() SK_OVERRIDE {
514 switch (fType) {
515 case kAdd_AddType:
516 return "path_add_path";
517 case kAddTrans_AddType:
518 return "path_add_path_trans";
519 case kAddMatrix_AddType:
520 return "path_add_path_matrix";
521 case kPathTo_AddType:
522 return "path_path_to";
523 case kReverseAdd_AddType:
524 return "path_reverse_add_path";
525 case kReversePathTo_AddType:
526 return "path_reverse_path_to";
527 default:
528 SkDEBUGFAIL("Bad add type");
529 return "";
530 }
531 }
532
533 virtual void onPreDraw() SK_OVERRIDE {
534 // pathTo and reversePathTo assume a single contour path.
535 bool allowMoves = kPathTo_AddType != fType &&
536 kReversePathTo_AddType != fType;
537 this->createData(10, 100, 2 * N, allowMoves);
538 SkASSERT(0 == fPaths0.count());
539 SkASSERT(0 == fPaths1.count());
540 fPaths0.resize_back(N);
541 fPaths1.resize_back(N);
542 for (int i = 0; i < N; ++i) {
543 this->makePath(&fPaths0[i]);
544 this->makePath(&fPaths1[i]);
545 }
546 this->finishedMakingPaths();
547 }
548
549 virtual void onDraw(SkCanvas*) SK_OVERRIDE {
550 switch (fType) {
551 case kAdd_AddType:
552 for (int i = 0; i < N; ++i) {
553 SkPath result = fPaths0[i];
554 result.addPath(fPaths1[i]);
555 }
556 break;
557 case kAddTrans_AddType:
558 for (int i = 0; i < N; ++i) {
559 SkPath result = fPaths0[i];
560 result.addPath(fPaths1[i], 2 * SK_Scalar1, 5 * SK_Scalar1);
561 }
562 break;
563 case kAddMatrix_AddType:
564 for (int i = 0; i < N; ++i) {
565 SkPath result = fPaths0[i];
566 result.addPath(fPaths1[i], fMatrix);
567 }
568 break;
569 case kPathTo_AddType:
570 for (int i = 0; i < N; ++i) {
571 SkPath result = fPaths0[i];
572 result.pathTo(fPaths1[i]);
573 }
574 break;
575 case kReverseAdd_AddType:
576 for (int i = 0; i < N; ++i) {
577 SkPath result = fPaths0[i];
578 result.reverseAddPath(fPaths1[i]);
579 }
580 break;
581 case kReversePathTo_AddType:
582 for (int i = 0; i < N; ++i) {
583 SkPath result = fPaths0[i];
584 result.reversePathTo(fPaths1[i]);
585 }
586 break;
587 }
588 }
589
590 virtual void onPostDraw() SK_OVERRIDE {
591 fPaths0.reset();
592 fPaths1.reset();
593 }
594
595private:
596 AddType fType; // or reverseAddPath
597 SkTArray<SkPath> fPaths0;
598 SkTArray<SkPath> fPaths1;
599 SkMatrix fMatrix;
600 typedef RandomPathBench INHERITED;
601};
tomhudson@google.com6e8d3352011-06-22 17:16:35 +0000602
reed@google.comd34658a2011-04-11 13:12:51 +0000603static SkBenchmark* FactT00(void* p) { return new TrianglePathBench(p, FLAGS00); }
604static SkBenchmark* FactT01(void* p) { return new TrianglePathBench(p, FLAGS01); }
605static SkBenchmark* FactT10(void* p) { return new TrianglePathBench(p, FLAGS10); }
606static SkBenchmark* FactT11(void* p) { return new TrianglePathBench(p, FLAGS11); }
607
608static SkBenchmark* FactR00(void* p) { return new RectPathBench(p, FLAGS00); }
609static SkBenchmark* FactR01(void* p) { return new RectPathBench(p, FLAGS01); }
610static SkBenchmark* FactR10(void* p) { return new RectPathBench(p, FLAGS10); }
611static SkBenchmark* FactR11(void* p) { return new RectPathBench(p, FLAGS11); }
612
613static SkBenchmark* FactO00(void* p) { return new OvalPathBench(p, FLAGS00); }
614static SkBenchmark* FactO01(void* p) { return new OvalPathBench(p, FLAGS01); }
615static SkBenchmark* FactO10(void* p) { return new OvalPathBench(p, FLAGS10); }
616static SkBenchmark* FactO11(void* p) { return new OvalPathBench(p, FLAGS11); }
617
bsalomon@google.com1647a192012-04-11 15:34:46 +0000618static SkBenchmark* FactC00(void* p) { return new CirclePathBench(p, FLAGS00); }
619static SkBenchmark* FactC01(void* p) { return new CirclePathBench(p, FLAGS01); }
620static SkBenchmark* FactC10(void* p) { return new CirclePathBench(p, FLAGS10); }
621static SkBenchmark* FactC11(void* p) { return new CirclePathBench(p, FLAGS11); }
622
reed@google.comd34658a2011-04-11 13:12:51 +0000623static SkBenchmark* FactS00(void* p) { return new SawToothPathBench(p, FLAGS00); }
624static SkBenchmark* FactS01(void* p) { return new SawToothPathBench(p, FLAGS01); }
625
tomhudson@google.com6e8d3352011-06-22 17:16:35 +0000626static SkBenchmark* FactLC00(void* p) {
627 return new LongCurvedPathBench(p, FLAGS00);
628}
629static SkBenchmark* FactLC01(void* p) {
630 return new LongCurvedPathBench(p, FLAGS01);
631}
632
senorblanco@chromium.orge50f7362012-01-12 19:10:35 +0000633static SkBenchmark* FactLL00(void* p) {
634 return new LongLinePathBench(p, FLAGS00);
635}
636
637static SkBenchmark* FactLL01(void* p) {
638 return new LongLinePathBench(p, FLAGS01);
639}
640
reed@google.comd34658a2011-04-11 13:12:51 +0000641static BenchRegistry gRegT00(FactT00);
642static BenchRegistry gRegT01(FactT01);
643static BenchRegistry gRegT10(FactT10);
644static BenchRegistry gRegT11(FactT11);
645
646static BenchRegistry gRegR00(FactR00);
647static BenchRegistry gRegR01(FactR01);
648static BenchRegistry gRegR10(FactR10);
649static BenchRegistry gRegR11(FactR11);
650
651static BenchRegistry gRegO00(FactO00);
652static BenchRegistry gRegO01(FactO01);
653static BenchRegistry gRegO10(FactO10);
654static BenchRegistry gRegO11(FactO11);
655
bsalomon@google.com1647a192012-04-11 15:34:46 +0000656static BenchRegistry gRegC00(FactC00);
657static BenchRegistry gRegC01(FactC01);
658static BenchRegistry gRegC10(FactC10);
659static BenchRegistry gRegC11(FactC11);
660
reed@google.comd34658a2011-04-11 13:12:51 +0000661static BenchRegistry gRegS00(FactS00);
662static BenchRegistry gRegS01(FactS01);
663
tomhudson@google.com6e8d3352011-06-22 17:16:35 +0000664static BenchRegistry gRegLC00(FactLC00);
665static BenchRegistry gRegLC01(FactLC01);
666
senorblanco@chromium.orge50f7362012-01-12 19:10:35 +0000667static BenchRegistry gRegLL00(FactLL00);
668static BenchRegistry gRegLL01(FactLL01);
669
bsalomon@google.com30e6d2c2012-08-13 14:03:31 +0000670static SkBenchmark* FactCreate(void* p) { return new PathCreateBench(p); }
671static BenchRegistry gRegCreate(FactCreate);
672
673static SkBenchmark* FactCopy(void* p) { return new PathCopyBench(p); }
674static BenchRegistry gRegCopy(FactCopy);
675
676static SkBenchmark* FactPathTransformInPlace(void* p) { return new PathTransformBench(true, p); }
677static BenchRegistry gRegPathTransformInPlace(FactPathTransformInPlace);
678
679static SkBenchmark* FactPathTransformCopy(void* p) { return new PathTransformBench(false, p); }
680static BenchRegistry gRegPathTransformCopy(FactPathTransformCopy);
681
682static SkBenchmark* FactEquality(void* p) { return new PathEqualityBench(p); }
683static BenchRegistry gRegEquality(FactEquality);
684
685static SkBenchmark* FactAdd(void* p) { return new SkBench_AddPathTest(SkBench_AddPathTest::kAdd_AddType, p); }
686static SkBenchmark* FactAddTrans(void* p) { return new SkBench_AddPathTest(SkBench_AddPathTest::kAddTrans_AddType, p); }
687static SkBenchmark* FactAddMatrix(void* p) { return new SkBench_AddPathTest(SkBench_AddPathTest::kAddMatrix_AddType, p); }
688static SkBenchmark* FactPathTo(void* p) { return new SkBench_AddPathTest(SkBench_AddPathTest::kPathTo_AddType, p); }
689static SkBenchmark* FactReverseAdd(void* p) { return new SkBench_AddPathTest(SkBench_AddPathTest::kReverseAdd_AddType, p); }
690static SkBenchmark* FactReverseTo(void* p) { return new SkBench_AddPathTest(SkBench_AddPathTest::kReversePathTo_AddType, p); }
691
692static BenchRegistry gRegAdd(FactAdd);
693static BenchRegistry gRegAddTrans(FactAddTrans);
694static BenchRegistry gRegAddMatrix(FactAddMatrix);
695static BenchRegistry gRegPathTo(FactPathTo);
696static BenchRegistry gRegReverseAdd(FactReverseAdd);
697static BenchRegistry gRegReverseTo(FactReverseTo);