| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkDashPathPriv.h" | 8 #include "SkDashPathPriv.h" |
| 9 #include "SkPathMeasure.h" | 9 #include "SkPathMeasure.h" |
| 10 #include "SkStrokeRec.h" | 10 #include "SkStrokeRec.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 ptCount = SkTMin(ptCount, SkDashPath::kMaxDashCount); | 179 ptCount = SkTMin(ptCount, SkDashPath::kMaxDashCount); |
| 180 int n = SkScalarCeilToInt(ptCount) << 2; | 180 int n = SkScalarCeilToInt(ptCount) << 2; |
| 181 dst->incReserve(n); | 181 dst->incReserve(n); |
| 182 | 182 |
| 183 // we will take care of the stroking | 183 // we will take care of the stroking |
| 184 rec->setFillStyle(); | 184 rec->setFillStyle(); |
| 185 return true; | 185 return true; |
| 186 } | 186 } |
| 187 | 187 |
| 188 void addSegment(SkScalar d0, SkScalar d1, SkPath* path) const { | 188 void addSegment(SkScalar d0, SkScalar d1, SkPath* path) const { |
| 189 SkASSERT(d0 < fPathLength); | 189 SkASSERT(d0 <= fPathLength); |
| 190 // clamp the segment to our length | 190 // clamp the segment to our length |
| 191 if (d1 > fPathLength) { | 191 if (d1 > fPathLength) { |
| 192 d1 = fPathLength; | 192 d1 = fPathLength; |
| 193 } | 193 } |
| 194 | 194 |
| 195 SkScalar x0 = fPts[0].fX + SkScalarMul(fTangent.fX, d0); | 195 SkScalar x0 = fPts[0].fX + SkScalarMul(fTangent.fX, d0); |
| 196 SkScalar x1 = fPts[0].fX + SkScalarMul(fTangent.fX, d1); | 196 SkScalar x1 = fPts[0].fX + SkScalarMul(fTangent.fX, d1); |
| 197 SkScalar y0 = fPts[0].fY + SkScalarMul(fTangent.fY, d0); | 197 SkScalar y0 = fPts[0].fY + SkScalarMul(fTangent.fY, d0); |
| 198 SkScalar y1 = fPts[0].fY + SkScalarMul(fTangent.fY, d1); | 198 SkScalar y1 = fPts[0].fY + SkScalarMul(fTangent.fY, d1); |
| 199 | 199 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 SkScalar length = 0; | 336 SkScalar length = 0; |
| 337 for (int i = 0; i < count; i++) { | 337 for (int i = 0; i < count; i++) { |
| 338 if (intervals[i] < 0) { | 338 if (intervals[i] < 0) { |
| 339 return false; | 339 return false; |
| 340 } | 340 } |
| 341 length += intervals[i]; | 341 length += intervals[i]; |
| 342 } | 342 } |
| 343 // watch out for values that might make us go out of bounds | 343 // watch out for values that might make us go out of bounds |
| 344 return length > 0 && SkScalarIsFinite(phase) && SkScalarIsFinite(length); | 344 return length > 0 && SkScalarIsFinite(phase) && SkScalarIsFinite(length); |
| 345 } | 345 } |
| OLD | NEW |