OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 void onDraw(int loops, SkCanvas* canvas) override { | 65 void onDraw(int loops, SkCanvas* canvas) override { |
66 SkPaint paint; | 66 SkPaint paint; |
67 this->setupPaint(&paint); | 67 this->setupPaint(&paint); |
68 paint.setStyle(SkPaint::kStroke_Style); | 68 paint.setStyle(SkPaint::kStroke_Style); |
69 paint.setStrokeWidth(SkIntToScalar(fWidth)); | 69 paint.setStrokeWidth(SkIntToScalar(fWidth)); |
70 paint.setAntiAlias(false); | 70 paint.setAntiAlias(false); |
71 | 71 |
72 SkPath path; | 72 SkPath path; |
73 this->makePath(&path); | 73 this->makePath(&path); |
74 | 74 |
75 paint.setPathEffect(SkDashPathEffect::Create(fIntervals.begin(), | 75 SkAutoTUnref<SkPathEffect> effect(SkDashPathEffect::Create(fIntervals.be
gin(), |
76 fIntervals.count(), 0))->un
ref(); | 76 fIntervals.count(), 0)); |
| 77 paint.setPathEffect(effect); |
77 | 78 |
78 if (fDoClip) { | 79 if (fDoClip) { |
79 SkRect r = path.getBounds(); | 80 SkRect r = path.getBounds(); |
80 r.inset(-SkIntToScalar(20), -SkIntToScalar(20)); | 81 r.inset(-SkIntToScalar(20), -SkIntToScalar(20)); |
81 // now move it so we don't intersect | 82 // now move it so we don't intersect |
82 r.offset(0, r.height() * 3 / 2); | 83 r.offset(0, r.height() * 3 / 2); |
83 canvas->clipRect(r); | 84 canvas->clipRect(r); |
84 } | 85 } |
85 | 86 |
86 this->handlePath(canvas, path, paint, loops); | 87 this->handlePath(canvas, path, paint, loops); |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 // hori_2 is just too slow to enable at the moment | 481 // hori_2 is just too slow to enable at the moment |
481 DEF_BENCH( return new GiantDashBench(GiantDashBench::kHori_LineType, 2); ) | 482 DEF_BENCH( return new GiantDashBench(GiantDashBench::kHori_LineType, 2); ) |
482 DEF_BENCH( return new GiantDashBench(GiantDashBench::kVert_LineType, 2); ) | 483 DEF_BENCH( return new GiantDashBench(GiantDashBench::kVert_LineType, 2); ) |
483 DEF_BENCH( return new GiantDashBench(GiantDashBench::kDiag_LineType, 2); ) | 484 DEF_BENCH( return new GiantDashBench(GiantDashBench::kDiag_LineType, 2); ) |
484 | 485 |
485 DEF_BENCH( return new DashGridBench(1, 1, true); ) | 486 DEF_BENCH( return new DashGridBench(1, 1, true); ) |
486 DEF_BENCH( return new DashGridBench(1, 1, false); ) | 487 DEF_BENCH( return new DashGridBench(1, 1, false); ) |
487 DEF_BENCH( return new DashGridBench(3, 1, true); ) | 488 DEF_BENCH( return new DashGridBench(3, 1, true); ) |
488 DEF_BENCH( return new DashGridBench(3, 1, false); ) | 489 DEF_BENCH( return new DashGridBench(3, 1, false); ) |
489 #endif | 490 #endif |
OLD | NEW |