| 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 "SkPath.h" | 10 #include "SkPath.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 "C 156,305 217,269 217,269 C 217,269 217,269 217,269 C 217,269 217,269 2
17,269" | 36 "C 156,305 217,269 217,269 C 217,269 217,269 217,269 C 217,269 217,269 2
17,269" |
| 37 "C 217,269 156,305 163,402 C 250,359 250,288 250,288 C 250,288 250,288 2
50,288" | 37 "C 217,269 156,305 163,402 C 250,359 250,288 250,288 C 250,288 250,288 2
50,288" |
| 38 "C 250,288 250,288 250,288 C 250,288 250,359 338,402 C 345,305 283,269 2
83,269" | 38 "C 250,288 250,288 250,288 C 250,288 250,359 338,402 C 345,305 283,269 2
83,269" |
| 39 "C 283,269 283,269 283,269 C 283,269 283,269 283,269 C 283,269 345,305 4
25,250" | 39 "C 283,269 283,269 283,269 C 283,269 283,269 283,269 C 283,269 345,305 4
25,250" |
| 40 "C 344,195 283,231 283,231 C 283,231 283,231 283,231 C 283,231 283,231 2
83,231" | 40 "C 344,195 283,231 283,231 C 283,231 283,231 283,231 C 283,231 283,231 2
83,231" |
| 41 "C 283,231 344,195 338,98"; | 41 "C 283,231 344,195 338,98"; |
| 42 | 42 |
| 43 SkParsePath::FromSVGString(d, &path); | 43 SkParsePath::FromSVGString(d, &path); |
| 44 | 44 |
| 45 SkScalar intervals[] = { 5, 10 }; | 45 SkScalar intervals[] = { 5, 10 }; |
| 46 SkPathEffect* pe = new SkDashPathEffect(intervals, 2, 0); | 46 SkPathEffect* pe = SkDashPathEffect::Create(intervals, 2, 0); |
| 47 | 47 |
| 48 SkPaint paint; | 48 SkPaint paint; |
| 49 paint.setAntiAlias(true); | 49 paint.setAntiAlias(true); |
| 50 paint.setStyle(SkPaint::kStroke_Style); | 50 paint.setStyle(SkPaint::kStroke_Style); |
| 51 | 51 |
| 52 paint.setStrokeWidth(42); | 52 paint.setStrokeWidth(42); |
| 53 canvas->drawPath(path, paint); | 53 canvas->drawPath(path, paint); |
| 54 | 54 |
| 55 paint.setColor(SK_ColorRED); | 55 paint.setColor(SK_ColorRED); |
| 56 paint.setStrokeWidth(21); | 56 paint.setStrokeWidth(21); |
| 57 paint.setPathEffect(pe)->unref(); | 57 paint.setPathEffect(pe)->unref(); |
| 58 canvas->drawPath(path, paint); | 58 canvas->drawPath(path, paint); |
| 59 | 59 |
| 60 paint.setColor(SK_ColorGREEN); | 60 paint.setColor(SK_ColorGREEN); |
| 61 paint.setPathEffect(NULL); | 61 paint.setPathEffect(NULL); |
| 62 paint.setStrokeWidth(0); | 62 paint.setStrokeWidth(0); |
| 63 canvas->drawPath(path, paint); | 63 canvas->drawPath(path, paint); |
| 64 } | 64 } |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 typedef GM INHERITED; | 67 typedef GM INHERITED; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 ////////////////////////////////////////////////////////////////////////////// | 70 ////////////////////////////////////////////////////////////////////////////// |
| 71 | 71 |
| 72 static skiagm::GM* MyFactory(void*) { return new DashCubicsGM; } | 72 static skiagm::GM* MyFactory(void*) { return new DashCubicsGM; } |
| 73 static skiagm::GMRegistry reg(MyFactory); | 73 static skiagm::GMRegistry reg(MyFactory); |
| OLD | NEW |