| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
| 9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
| 10 #include "SkMatrixUtils.h" | 10 #include "SkMatrixUtils.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 float fArray[9]; | 139 float fArray[9]; |
| 140 SkRandom fRnd; | 140 SkRandom fRnd; |
| 141 typedef MatrixBench INHERITED; | 141 typedef MatrixBench INHERITED; |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 class DecomposeMatrixBench : public MatrixBench { | 144 class DecomposeMatrixBench : public MatrixBench { |
| 145 public: | 145 public: |
| 146 DecomposeMatrixBench() : INHERITED("decompose") {} | 146 DecomposeMatrixBench() : INHERITED("decompose") {} |
| 147 | 147 |
| 148 protected: | 148 protected: |
| 149 void onPreDraw() override { | 149 void onDelayedSetup() override { |
| 150 for (int i = 0; i < 10; ++i) { | 150 for (int i = 0; i < 10; ++i) { |
| 151 SkScalar rot0 = (fRandom.nextBool()) ? fRandom.nextRangeF(-180, 180)
: 0.0f; | 151 SkScalar rot0 = (fRandom.nextBool()) ? fRandom.nextRangeF(-180, 180)
: 0.0f; |
| 152 SkScalar sx = fRandom.nextRangeF(-3000.f, 3000.f); | 152 SkScalar sx = fRandom.nextRangeF(-3000.f, 3000.f); |
| 153 SkScalar sy = (fRandom.nextBool()) ? fRandom.nextRangeF(-3000.f, 300
0.f) : sx; | 153 SkScalar sy = (fRandom.nextBool()) ? fRandom.nextRangeF(-3000.f, 300
0.f) : sx; |
| 154 SkScalar rot1 = fRandom.nextRangeF(-180, 180); | 154 SkScalar rot1 = fRandom.nextRangeF(-180, 180); |
| 155 fMatrix[i].setRotate(rot0); | 155 fMatrix[i].setRotate(rot0); |
| 156 fMatrix[i].postScale(sx, sy); | 156 fMatrix[i].postScale(sx, sy); |
| 157 fMatrix[i].postRotate(rot1); | 157 fMatrix[i].postRotate(rot1); |
| 158 } | 158 } |
| 159 } | 159 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 for (int i = 0; i < 1000000; ++i) { | 292 for (int i = 0; i < 1000000; ++i) { |
| 293 fM.mapPoints(fDst, fSrc, N); | 293 fM.mapPoints(fDst, fSrc, N); |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 }; | 296 }; |
| 297 DEF_BENCH( return new MapPointsMatrixBench("mappoints_identity", SkMatrix::I());
) | 297 DEF_BENCH( return new MapPointsMatrixBench("mappoints_identity", SkMatrix::I());
) |
| 298 DEF_BENCH( return new MapPointsMatrixBench("mappoints_trans", make_trans()); ) | 298 DEF_BENCH( return new MapPointsMatrixBench("mappoints_trans", make_trans()); ) |
| 299 DEF_BENCH( return new MapPointsMatrixBench("mappoints_scale", make_scale()); ) | 299 DEF_BENCH( return new MapPointsMatrixBench("mappoints_scale", make_scale()); ) |
| 300 DEF_BENCH( return new MapPointsMatrixBench("mappoints_affine", make_afine()); ) | 300 DEF_BENCH( return new MapPointsMatrixBench("mappoints_affine", make_afine()); ) |
| 301 | 301 |
| OLD | NEW |