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