| 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" | |
| 10 #include "SkBenchmark.h" | 7 #include "SkBenchmark.h" |
| 11 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 12 #include "SkPaint.h" | 9 #include "SkPaint.h" |
| 13 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| 14 #include "SkShader.h" | 11 #include "SkShader.h" |
| 15 #include "SkString.h" | 12 #include "SkString.h" |
| 16 | 13 |
| 17 enum Flags { | 14 enum Flags { |
| 18 kBig_Flag = 1 << 0, | 15 kBig_Flag = 1 << 0, |
| 19 kAA_Flag = 1 << 1 | 16 kAA_Flag = 1 << 1 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 float weight = randWeight.nextRangeF(0.0f, 2.0f); | 163 float weight = randWeight.nextRangeF(0.0f, 2.0f); |
| 167 path->moveTo(SkIntToScalar(points[base1] + xTrans), | 164 path->moveTo(SkIntToScalar(points[base1] + xTrans), |
| 168 SkIntToScalar(points[base1+1] + yTrans)); | 165 SkIntToScalar(points[base1+1] + yTrans)); |
| 169 path->conicTo(SkIntToScalar(points[base2] + xTrans), | 166 path->conicTo(SkIntToScalar(points[base2] + xTrans), |
| 170 SkIntToScalar(points[base2+1] + yTrans), | 167 SkIntToScalar(points[base2+1] + yTrans), |
| 171 SkIntToScalar(points[base3] + xTrans), | 168 SkIntToScalar(points[base3] + xTrans), |
| 172 SkIntToScalar(points[base3+1] + yTrans), | 169 SkIntToScalar(points[base3+1] + yTrans), |
| 173 weight); | 170 weight); |
| 174 } | 171 } |
| 175 } | 172 } |
| 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 | |
| 190 private: | 173 private: |
| 191 typedef HairlinePathBench INHERITED; | 174 typedef HairlinePathBench INHERITED; |
| 192 }; | 175 }; |
| 193 | 176 |
| 194 class CubicPathBench : public HairlinePathBench { | 177 class CubicPathBench : public HairlinePathBench { |
| 195 public: | 178 public: |
| 196 CubicPathBench(Flags flags) : INHERITED(flags) {} | 179 CubicPathBench(Flags flags) : INHERITED(flags) {} |
| 197 | 180 |
| 198 virtual void appendName(SkString* name) SK_OVERRIDE { | 181 virtual void appendName(SkString* name) SK_OVERRIDE { |
| 199 name->append("cubic"); | 182 name->append("cubic"); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 // Don't have default path renderer for conics yet on GPU, so must use AA | 227 // Don't have default path renderer for conics yet on GPU, so must use AA |
| 245 // DEF_BENCH( return new ConicPathBench(FLAGS00); ) | 228 // DEF_BENCH( return new ConicPathBench(FLAGS00); ) |
| 246 // DEF_BENCH( return new ConicPathBench(FLAGS01); ) | 229 // DEF_BENCH( return new ConicPathBench(FLAGS01); ) |
| 247 DEF_BENCH( return new ConicPathBench(FLAGS10); ) | 230 DEF_BENCH( return new ConicPathBench(FLAGS10); ) |
| 248 DEF_BENCH( return new ConicPathBench(FLAGS11); ) | 231 DEF_BENCH( return new ConicPathBench(FLAGS11); ) |
| 249 | 232 |
| 250 DEF_BENCH( return new CubicPathBench(FLAGS00); ) | 233 DEF_BENCH( return new CubicPathBench(FLAGS00); ) |
| 251 DEF_BENCH( return new CubicPathBench(FLAGS01); ) | 234 DEF_BENCH( return new CubicPathBench(FLAGS01); ) |
| 252 DEF_BENCH( return new CubicPathBench(FLAGS10); ) | 235 DEF_BENCH( return new CubicPathBench(FLAGS10); ) |
| 253 DEF_BENCH( return new CubicPathBench(FLAGS11); ) | 236 DEF_BENCH( return new CubicPathBench(FLAGS11); ) |
| OLD | NEW |