| 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 "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 for (size_t i = 0; i < SK_ARRAY_COUNT(gStr); i++) { | 66 for (size_t i = 0; i < SK_ARRAY_COUNT(gStr); i++) { |
| 67 SkScalar interval[12]; | 67 SkScalar interval[12]; |
| 68 size_t len = SkMin32(strlen(gStr[i]), SK_ARRAY_COUNT(interval)); | 68 size_t len = SkMin32(strlen(gStr[i]), SK_ARRAY_COUNT(interval)); |
| 69 for (size_t j = 0; j < len; j++) { | 69 for (size_t j = 0; j < len; j++) { |
| 70 interval[j] = SkIntToScalar(gStr[i][j] - '0'); | 70 interval[j] = SkIntToScalar(gStr[i][j] - '0'); |
| 71 } | 71 } |
| 72 | 72 |
| 73 SkDashPathEffect dash(interval, len, 0); | 73 SkDashPathEffect dash(interval, len, 0); |
| 74 paint.setPathEffect(&dash); | 74 paint.setPathEffect(&dash); |
| 75 canvas->drawLine(x0, y0, x1, y0, paint); | 75 canvas->drawLine(x0, y0, x1, y0, paint); |
| 76 paint.setPathEffect(NULL); | 76 paint.setPathEffect(nullptr); |
| 77 | 77 |
| 78 y0 += paint.getStrokeWidth() * 3; | 78 y0 += paint.getStrokeWidth() * 3; |
| 79 } | 79 } |
| 80 | 80 |
| 81 setBitmapDash(&paint, 3); | 81 setBitmapDash(&paint, 3); |
| 82 canvas->drawLine(x0, y0, x1, y0, paint); | 82 canvas->drawLine(x0, y0, x1, y0, paint); |
| 83 } | 83 } |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 typedef SampleView INHERITED; | 86 typedef SampleView INHERITED; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 ////////////////////////////////////////////////////////////////////////////// | 89 ////////////////////////////////////////////////////////////////////////////// |
| 90 | 90 |
| 91 static SkView* MyFactory() { return new DashView; } | 91 static SkView* MyFactory() { return new DashView; } |
| 92 static SkViewRegister reg(MyFactory); | 92 static SkViewRegister reg(MyFactory); |
| OLD | NEW |