OLD | NEW |
1 #include "SkBenchmark.h" | 1 #include "SkBenchmark.h" |
2 #include "SkColorPriv.h" | 2 #include "SkColorPriv.h" |
3 #include "SkMatrix.h" | 3 #include "SkMatrix.h" |
4 #include "SkRandom.h" | 4 #include "SkRandom.h" |
5 #include "SkString.h" | 5 #include "SkString.h" |
6 #include "SkPaint.h" | 6 #include "SkPaint.h" |
7 | 7 |
8 static float sk_fsel(float pred, float result_ge, float result_lt) { | 8 static float sk_fsel(float pred, float result_ge, float result_lt) { |
9 return pred >= 0 ? result_ge : result_lt; | 9 return pred >= 0 ? result_ge : result_lt; |
10 } | 10 } |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 }; | 432 }; |
433 | 433 |
434 /////////////////////////////////////////////////////////////////////////////// | 434 /////////////////////////////////////////////////////////////////////////////// |
435 | 435 |
436 class NormalizeBench : public SkBenchmark { | 436 class NormalizeBench : public SkBenchmark { |
437 enum { | 437 enum { |
438 ARRAY = SkBENCHLOOP(1000), | 438 ARRAY = SkBENCHLOOP(1000), |
439 LOOP = SkBENCHLOOP(1000), | 439 LOOP = SkBENCHLOOP(1000), |
440 }; | 440 }; |
441 SkVector fVec[ARRAY]; | 441 SkVector fVec[ARRAY]; |
442 bool fUsePortable; | |
443 | 442 |
444 public: | 443 public: |
445 NormalizeBench(void* param, bool usePortable) | 444 NormalizeBench(void* param) |
446 : INHERITED(param) | 445 : INHERITED(param) { |
447 , fUsePortable(usePortable) { | |
448 | 446 |
449 SkRandom rand; | 447 SkRandom rand; |
450 for (int i = 0; i < ARRAY; ++i) { | 448 for (int i = 0; i < ARRAY; ++i) { |
451 fVec[i].set(rand.nextSScalar1(), rand.nextSScalar1()); | 449 fVec[i].set(rand.nextSScalar1(), rand.nextSScalar1()); |
452 } | 450 } |
453 | 451 |
454 fName = "point_normalize"; | 452 fName = "point_normalize"; |
455 fIsRendering = false; | 453 fIsRendering = false; |
456 } | 454 } |
457 | 455 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 DEF_BENCH( return new IsFiniteBench(p, 3); ) | 493 DEF_BENCH( return new IsFiniteBench(p, 3); ) |
496 DEF_BENCH( return new IsFiniteBench(p, 4); ) | 494 DEF_BENCH( return new IsFiniteBench(p, 4); ) |
497 DEF_BENCH( return new IsFiniteBench(p, 5); ) | 495 DEF_BENCH( return new IsFiniteBench(p, 5); ) |
498 | 496 |
499 DEF_BENCH( return new FloorBench(p, false); ) | 497 DEF_BENCH( return new FloorBench(p, false); ) |
500 DEF_BENCH( return new FloorBench(p, true); ) | 498 DEF_BENCH( return new FloorBench(p, true); ) |
501 | 499 |
502 DEF_BENCH( return new CLZBench(p, false); ) | 500 DEF_BENCH( return new CLZBench(p, false); ) |
503 DEF_BENCH( return new CLZBench(p, true); ) | 501 DEF_BENCH( return new CLZBench(p, true); ) |
504 | 502 |
505 DEF_BENCH( return new NormalizeBench(p, false); ) | 503 DEF_BENCH( return new NormalizeBench(p); ) |
OLD | NEW |