| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 | 7 |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 p.setColor(SK_ColorBLACK); | 195 p.setColor(SK_ColorBLACK); |
| 196 p.setStyle(SkPaint::kStroke_Style); | 196 p.setStyle(SkPaint::kStroke_Style); |
| 197 p.setStrokeWidth(SkIntToScalar(strokeWidth)); | 197 p.setStrokeWidth(SkIntToScalar(strokeWidth)); |
| 198 | 198 |
| 199 if (circles) { | 199 if (circles) { |
| 200 p.setStrokeCap(SkPaint::kRound_Cap); | 200 p.setStrokeCap(SkPaint::kRound_Cap); |
| 201 } | 201 } |
| 202 | 202 |
| 203 SkScalar intervals[2] = { dashLength, dashLength }; | 203 SkScalar intervals[2] = { dashLength, dashLength }; |
| 204 | 204 |
| 205 p.setPathEffect(new SkDashPathEffect(intervals, 2, phase, false)); | 205 p.setPathEffect(new SkDashPathEffect(intervals, 2, phase, false))->unref
(); |
| 206 | 206 |
| 207 SkPoint pts[2]; | 207 SkPoint pts[2]; |
| 208 | 208 |
| 209 for (int y = 0; y < 100; y += 10*strokeWidth) { | 209 for (int y = 0; y < 100; y += 10*strokeWidth) { |
| 210 pts[0].set(0, SkIntToScalar(y)); | 210 pts[0].set(0, SkIntToScalar(y)); |
| 211 pts[1].set(lineLength, SkIntToScalar(y)); | 211 pts[1].set(lineLength, SkIntToScalar(y)); |
| 212 | 212 |
| 213 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts, p); | 213 canvas->drawPoints(SkCanvas::kLines_PointMode, 2, pts, p); |
| 214 } | 214 } |
| 215 | 215 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 301 |
| 302 ////////////////////////////////////////////////////////////////////////////// | 302 ////////////////////////////////////////////////////////////////////////////// |
| 303 | 303 |
| 304 static skiagm::GM* F0(void*) { return new DashingGM; } | 304 static skiagm::GM* F0(void*) { return new DashingGM; } |
| 305 static skiagm::GM* F1(void*) { return new Dashing2GM; } | 305 static skiagm::GM* F1(void*) { return new Dashing2GM; } |
| 306 static skiagm::GM* F2(void*) { return new Dashing3GM; } | 306 static skiagm::GM* F2(void*) { return new Dashing3GM; } |
| 307 | 307 |
| 308 static skiagm::GMRegistry gR0(F0); | 308 static skiagm::GMRegistry gR0(F0); |
| 309 static skiagm::GMRegistry gR1(F1); | 309 static skiagm::GMRegistry gR1(F1); |
| 310 static skiagm::GMRegistry gR2(F2); | 310 static skiagm::GMRegistry gR2(F2); |
| OLD | NEW |