| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "Benchmark.h" | 7 #include "Benchmark.h" |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| 11 #include "SkPatchUtils.h" | 11 #include "SkPatchUtils.h" |
| 12 #include "SkString.h" | 12 #include "SkString.h" |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * This bench measures the rendering time of the call SkCanvas::drawPatch with d
ifferent types of | 15 * This bench measures the rendering time of the call SkCanvas::drawPatch with d
ifferent types of |
| 16 * input patches (regular case, with loops, a square, with a big difference betw
een "parallel" | 16 * input patches (regular case, with loops, a square, with a big difference betw
een "parallel" |
| 17 * sides). This bench also tests the different combination of optional parameter
s for the function | 17 * sides). This bench also tests the different combination of optional parameter
s for the function |
| 18 * (passing texture coordinates and colors, only textures coordinates, only colo
rs or none). | 18 * (passing texture coordinates and colors, only textures coordinates, only colo
rs or none). |
| 19 * Finally, it applies a scale to test if the size affects the rendering time. | 19 * Finally, it applies a scale to test if the size affects the rendering time. |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 class PatchBench : public Benchmark { | 22 class PatchBench : public Benchmark { |
| 23 | 23 |
| 24 public: | 24 public: |
| 25 | 25 |
| 26 enum VertexMode { | 26 enum VertexMode { |
| 27 kNone_VertexMode, | 27 kNone_VertexMode, |
| 28 kColors_VertexMode, | 28 kColors_VertexMode, |
| 29 kTexCoords_VertexMode, | 29 kTexCoords_VertexMode, |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 DEF_BENCH( return new LoopPatchBench(SkVector::Make(1.0f, 1.0f), | 315 DEF_BENCH( return new LoopPatchBench(SkVector::Make(1.0f, 1.0f), |
| 316 PatchBench::kBoth_VertexMode); ) | 316 PatchBench::kBoth_VertexMode); ) |
| 317 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), | 317 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), |
| 318 PatchBench::kNone_VertexMode); ) | 318 PatchBench::kNone_VertexMode); ) |
| 319 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), | 319 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), |
| 320 PatchBench::kColors_VertexMode); ) | 320 PatchBench::kColors_VertexMode); ) |
| 321 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), | 321 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), |
| 322 PatchBench::kTexCoords_VertexMode); ) | 322 PatchBench::kTexCoords_VertexMode); ) |
| 323 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), | 323 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), |
| 324 PatchBench::kBoth_VertexMode); ) | 324 PatchBench::kBoth_VertexMode); ) |
| OLD | NEW |