OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkDashPathEffect.h" | 8 #include "SkDashPathEffect.h" |
9 | 9 |
10 #include "SkDashPathPriv.h" | 10 #include "SkDashPathPriv.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if (SK_Scalar1 == tangent.fX || -SK_Scalar1 == tangent.fX) { | 97 if (SK_Scalar1 == tangent.fX || -SK_Scalar1 == tangent.fX) { |
98 results->fSize.set(SkScalarHalf(fIntervals[0]), SkScalarHalf(rec.getWidt
h())); | 98 results->fSize.set(SkScalarHalf(fIntervals[0]), SkScalarHalf(rec.getWidt
h())); |
99 } else if (SK_Scalar1 == tangent.fY || -SK_Scalar1 == tangent.fY) { | 99 } else if (SK_Scalar1 == tangent.fY || -SK_Scalar1 == tangent.fY) { |
100 results->fSize.set(SkScalarHalf(rec.getWidth()), SkScalarHalf(fIntervals
[0])); | 100 results->fSize.set(SkScalarHalf(rec.getWidth()), SkScalarHalf(fIntervals
[0])); |
101 isXAxis = false; | 101 isXAxis = false; |
102 } else if (SkPaint::kRound_Cap != rec.getCap()) { | 102 } else if (SkPaint::kRound_Cap != rec.getCap()) { |
103 // Angled lines don't have axis-aligned boxes. | 103 // Angled lines don't have axis-aligned boxes. |
104 return false; | 104 return false; |
105 } | 105 } |
106 | 106 |
107 if (NULL != results) { | 107 if (results) { |
108 results->fFlags = 0; | 108 results->fFlags = 0; |
109 SkScalar clampedInitialDashLength = SkMinScalar(length, fInitialDashLeng
th); | 109 SkScalar clampedInitialDashLength = SkMinScalar(length, fInitialDashLeng
th); |
110 | 110 |
111 if (SkPaint::kRound_Cap == rec.getCap()) { | 111 if (SkPaint::kRound_Cap == rec.getCap()) { |
112 results->fFlags |= PointData::kCircles_PointFlag; | 112 results->fFlags |= PointData::kCircles_PointFlag; |
113 } | 113 } |
114 | 114 |
115 results->fNumPoints = 0; | 115 results->fNumPoints = 0; |
116 SkScalar len2 = length; | 116 SkScalar len2 = length; |
117 if (clampedInitialDashLength > 0 || 0 == fInitialDashIndex) { | 117 if (clampedInitialDashLength > 0 || 0 == fInitialDashIndex) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 222 } |
223 | 223 |
224 SkASSERT(curPt == results->fNumPoints); | 224 SkASSERT(curPt == results->fNumPoints); |
225 } | 225 } |
226 | 226 |
227 return true; | 227 return true; |
228 } | 228 } |
229 | 229 |
230 SkPathEffect::DashType SkDashPathEffect::asADash(DashInfo* info) const { | 230 SkPathEffect::DashType SkDashPathEffect::asADash(DashInfo* info) const { |
231 if (info) { | 231 if (info) { |
232 if (info->fCount >= fCount && NULL != info->fIntervals) { | 232 if (info->fCount >= fCount && info->fIntervals) { |
233 memcpy(info->fIntervals, fIntervals, fCount * sizeof(SkScalar)); | 233 memcpy(info->fIntervals, fIntervals, fCount * sizeof(SkScalar)); |
234 } | 234 } |
235 info->fCount = fCount; | 235 info->fCount = fCount; |
236 info->fPhase = fPhase; | 236 info->fPhase = fPhase; |
237 } | 237 } |
238 return kDash_DashType; | 238 return kDash_DashType; |
239 } | 239 } |
240 | 240 |
241 void SkDashPathEffect::flatten(SkWriteBuffer& buffer) const { | 241 void SkDashPathEffect::flatten(SkWriteBuffer& buffer) const { |
242 buffer.writeScalar(fPhase); | 242 buffer.writeScalar(fPhase); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 } else { | 290 } else { |
291 // set the internal data members, fPhase should have been between 0 and
intervalLength | 291 // set the internal data members, fPhase should have been between 0 and
intervalLength |
292 // when written to buffer so no need to adjust it | 292 // when written to buffer so no need to adjust it |
293 SkDashPath::CalcDashParameters(fPhase, fIntervals, fCount, | 293 SkDashPath::CalcDashParameters(fPhase, fIntervals, fCount, |
294 &fInitialDashLength, &fInitialDashIndex, &fIntervalLength); | 294 &fInitialDashLength, &fInitialDashIndex, &fIntervalLength); |
295 } | 295 } |
296 } | 296 } |
297 #endif | 297 #endif |
298 | 298 |
OLD | NEW |