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" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 default: | 100 default: |
101 break; | 101 break; |
102 } | 102 } |
103 SkString type; | 103 SkString type; |
104 this->appendName(&type); | 104 this->appendName(&type); |
105 fName.printf("patch_%s_%s_[%f,%f]", type.c_str(), vertexMode.c_str(), | 105 fName.printf("patch_%s_%s_[%f,%f]", type.c_str(), vertexMode.c_str(), |
106 fScale.x(), fScale.y()); | 106 fScale.x(), fScale.y()); |
107 return fName.c_str(); | 107 return fName.c_str(); |
108 } | 108 } |
109 | 109 |
110 void onPreDraw() override { | 110 void onDelayedSetup() override { |
111 this->setCubics(); | 111 this->setCubics(); |
112 this->setColors(); | 112 this->setColors(); |
113 this->setTexCoords(); | 113 this->setTexCoords(); |
114 this->setupPaint(&fPaint); | 114 this->setupPaint(&fPaint); |
115 switch (fVertexMode) { | 115 switch (fVertexMode) { |
116 case kTexCoords_VertexMode: | 116 case kTexCoords_VertexMode: |
117 case kBoth_VertexMode: | 117 case kBoth_VertexMode: |
118 fPaint.setShader(this->createShader())->unref(); | 118 fPaint.setShader(this->createShader())->unref(); |
119 break; | 119 break; |
120 default: | 120 default: |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 DEF_BENCH( return new LoopPatchBench(SkVector::Make(1.0f, 1.0f), | 316 DEF_BENCH( return new LoopPatchBench(SkVector::Make(1.0f, 1.0f), |
317 PatchBench::kBoth_VertexMode); ) | 317 PatchBench::kBoth_VertexMode); ) |
318 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), | 318 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), |
319 PatchBench::kNone_VertexMode); ) | 319 PatchBench::kNone_VertexMode); ) |
320 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), | 320 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), |
321 PatchBench::kColors_VertexMode); ) | 321 PatchBench::kColors_VertexMode); ) |
322 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), | 322 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), |
323 PatchBench::kTexCoords_VertexMode); ) | 323 PatchBench::kTexCoords_VertexMode); ) |
324 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), | 324 DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), |
325 PatchBench::kBoth_VertexMode); ) | 325 PatchBench::kBoth_VertexMode); ) |
OLD | NEW |