OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 |
| 8 #include "GrTest.h" |
| 9 #include "GrDrawTargetCaps.h" |
7 #include "SkBenchmark.h" | 10 #include "SkBenchmark.h" |
8 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
9 #include "SkPaint.h" | 12 #include "SkPaint.h" |
10 #include "SkRandom.h" | 13 #include "SkRandom.h" |
11 #include "SkShader.h" | 14 #include "SkShader.h" |
12 #include "SkString.h" | 15 #include "SkString.h" |
13 | 16 |
14 enum Flags { | 17 enum Flags { |
15 kBig_Flag = 1 << 0, | 18 kBig_Flag = 1 << 0, |
16 kAA_Flag = 1 << 1 | 19 kAA_Flag = 1 << 1 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 float weight = randWeight.nextRangeF(0.0f, 2.0f); | 166 float weight = randWeight.nextRangeF(0.0f, 2.0f); |
164 path->moveTo(SkIntToScalar(points[base1] + xTrans), | 167 path->moveTo(SkIntToScalar(points[base1] + xTrans), |
165 SkIntToScalar(points[base1+1] + yTrans)); | 168 SkIntToScalar(points[base1+1] + yTrans)); |
166 path->conicTo(SkIntToScalar(points[base2] + xTrans), | 169 path->conicTo(SkIntToScalar(points[base2] + xTrans), |
167 SkIntToScalar(points[base2+1] + yTrans), | 170 SkIntToScalar(points[base2+1] + yTrans), |
168 SkIntToScalar(points[base3] + xTrans), | 171 SkIntToScalar(points[base3] + xTrans), |
169 SkIntToScalar(points[base3+1] + yTrans), | 172 SkIntToScalar(points[base3+1] + yTrans), |
170 weight); | 173 weight); |
171 } | 174 } |
172 } | 175 } |
| 176 |
| 177 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { |
| 178 GrContext* context = canvas->getGrContext(); |
| 179 // This is a workaround for skbug.com/2078. See also skbug.com/2033. |
| 180 if (NULL != context) { |
| 181 GrTestTarget tt; |
| 182 context->getTestTarget(&tt); |
| 183 if (tt.target()->caps()->pathRenderingSupport()) { |
| 184 return; |
| 185 } |
| 186 } |
| 187 INHERITED::onDraw(loops, canvas); |
| 188 } |
| 189 |
173 private: | 190 private: |
174 typedef HairlinePathBench INHERITED; | 191 typedef HairlinePathBench INHERITED; |
175 }; | 192 }; |
176 | 193 |
177 class CubicPathBench : public HairlinePathBench { | 194 class CubicPathBench : public HairlinePathBench { |
178 public: | 195 public: |
179 CubicPathBench(Flags flags) : INHERITED(flags) {} | 196 CubicPathBench(Flags flags) : INHERITED(flags) {} |
180 | 197 |
181 virtual void appendName(SkString* name) SK_OVERRIDE { | 198 virtual void appendName(SkString* name) SK_OVERRIDE { |
182 name->append("cubic"); | 199 name->append("cubic"); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // Don't have default path renderer for conics yet on GPU, so must use AA | 244 // Don't have default path renderer for conics yet on GPU, so must use AA |
228 // DEF_BENCH( return new ConicPathBench(FLAGS00); ) | 245 // DEF_BENCH( return new ConicPathBench(FLAGS00); ) |
229 // DEF_BENCH( return new ConicPathBench(FLAGS01); ) | 246 // DEF_BENCH( return new ConicPathBench(FLAGS01); ) |
230 DEF_BENCH( return new ConicPathBench(FLAGS10); ) | 247 DEF_BENCH( return new ConicPathBench(FLAGS10); ) |
231 DEF_BENCH( return new ConicPathBench(FLAGS11); ) | 248 DEF_BENCH( return new ConicPathBench(FLAGS11); ) |
232 | 249 |
233 DEF_BENCH( return new CubicPathBench(FLAGS00); ) | 250 DEF_BENCH( return new CubicPathBench(FLAGS00); ) |
234 DEF_BENCH( return new CubicPathBench(FLAGS01); ) | 251 DEF_BENCH( return new CubicPathBench(FLAGS01); ) |
235 DEF_BENCH( return new CubicPathBench(FLAGS10); ) | 252 DEF_BENCH( return new CubicPathBench(FLAGS10); ) |
236 DEF_BENCH( return new CubicPathBench(FLAGS11); ) | 253 DEF_BENCH( return new CubicPathBench(FLAGS11); ) |
OLD | NEW |