epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 8 | #include "SkDashPathEffect.h" |
egdaniel | a22ea18 | 2014-06-11 06:51:51 -0700 | [diff] [blame] | 9 | |
| 10 | #include "SkDashPathPriv.h" |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 11 | #include "SkReadBuffer.h" |
| 12 | #include "SkWriteBuffer.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 13 | |
mtklein | 1c577cd | 2014-07-09 09:54:10 -0700 | [diff] [blame] | 14 | SkDashPathEffect::SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase) |
| 15 | : fPhase(0) |
| 16 | , fInitialDashLength(0) |
| 17 | , fInitialDashIndex(0) |
| 18 | , fIntervalLength(0) { |
commit-bot@chromium.org | aec1438 | 2014-04-22 15:21:18 +0000 | [diff] [blame] | 19 | SkASSERT(intervals); |
| 20 | SkASSERT(count > 1 && SkAlign2(count) == count); |
| 21 | |
| 22 | fIntervals = (SkScalar*)sk_malloc_throw(sizeof(SkScalar) * count); |
| 23 | fCount = count; |
| 24 | for (int i = 0; i < count; i++) { |
| 25 | SkASSERT(intervals[i] >= 0); |
| 26 | fIntervals[i] = intervals[i]; |
| 27 | } |
| 28 | |
egdaniel | a22ea18 | 2014-06-11 06:51:51 -0700 | [diff] [blame] | 29 | // set the internal data members |
mtklein | 1c577cd | 2014-07-09 09:54:10 -0700 | [diff] [blame] | 30 | SkDashPath::CalcDashParameters(phase, fIntervals, fCount, |
| 31 | &fInitialDashLength, &fInitialDashIndex, &fIntervalLength, &fPhase); |
commit-bot@chromium.org | aec1438 | 2014-04-22 15:21:18 +0000 | [diff] [blame] | 32 | } |
| 33 | |
mike@reedtribe.org | 3334c3a | 2011-04-20 11:39:28 +0000 | [diff] [blame] | 34 | SkDashPathEffect::~SkDashPathEffect() { |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 35 | sk_free(fIntervals); |
| 36 | } |
| 37 | |
mike@reedtribe.org | 3334c3a | 2011-04-20 11:39:28 +0000 | [diff] [blame] | 38 | bool SkDashPathEffect::filterPath(SkPath* dst, const SkPath& src, |
reed@google.com | 4bbdeac | 2013-01-24 21:03:11 +0000 | [diff] [blame] | 39 | SkStrokeRec* rec, const SkRect* cullRect) const { |
egdaniel | a22ea18 | 2014-06-11 06:51:51 -0700 | [diff] [blame] | 40 | return SkDashPath::FilterDashPath(dst, src, rec, cullRect, fIntervals, fCount, |
| 41 | fInitialDashLength, fInitialDashIndex, fIntervalLength); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 42 | } |
| 43 | |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 44 | // Currently asPoints is more restrictive then it needs to be. In the future |
| 45 | // we need to: |
| 46 | // allow kRound_Cap capping (could allow rotations in the matrix with this) |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 47 | // allow paths to be returned |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 48 | bool SkDashPathEffect::asPoints(PointData* results, |
| 49 | const SkPath& src, |
| 50 | const SkStrokeRec& rec, |
reed@google.com | 4bbdeac | 2013-01-24 21:03:11 +0000 | [diff] [blame] | 51 | const SkMatrix& matrix, |
| 52 | const SkRect* cullRect) const { |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 53 | // width < 0 -> fill && width == 0 -> hairline so requiring width > 0 rules both out |
| 54 | if (fInitialDashLength < 0 || 0 >= rec.getWidth()) { |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 55 | return false; |
| 56 | } |
| 57 | |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 58 | // TODO: this next test could be eased up. We could allow any number of |
| 59 | // intervals as long as all the ons match and all the offs match. |
| 60 | // Additionally, they do not necessarily need to be integers. |
| 61 | // We cannot allow arbitrary intervals since we want the returned points |
| 62 | // to be uniformly sized. |
skia.committer@gmail.com | 7a03d86 | 2012-12-18 02:03:03 +0000 | [diff] [blame] | 63 | if (fCount != 2 || |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 64 | !SkScalarNearlyEqual(fIntervals[0], fIntervals[1]) || |
| 65 | !SkScalarIsInt(fIntervals[0]) || |
| 66 | !SkScalarIsInt(fIntervals[1])) { |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 67 | return false; |
| 68 | } |
| 69 | |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 70 | SkPoint pts[2]; |
| 71 | |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 72 | if (!src.isLine(pts)) { |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 73 | return false; |
| 74 | } |
| 75 | |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 76 | // TODO: this test could be eased up to allow circles |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 77 | if (SkPaint::kButt_Cap != rec.getCap()) { |
| 78 | return false; |
| 79 | } |
| 80 | |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 81 | // TODO: this test could be eased up for circles. Rotations could be allowed. |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 82 | if (!matrix.rectStaysRect()) { |
| 83 | return false; |
| 84 | } |
| 85 | |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 86 | SkScalar length = SkPoint::Distance(pts[1], pts[0]); |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 87 | |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 88 | SkVector tangent = pts[1] - pts[0]; |
| 89 | if (tangent.isZero()) { |
| 90 | return false; |
| 91 | } |
| 92 | |
| 93 | tangent.scale(SkScalarInvert(length)); |
| 94 | |
| 95 | // TODO: make this test for horizontal & vertical lines more robust |
| 96 | bool isXAxis = true; |
| 97 | if (SK_Scalar1 == tangent.fX || -SK_Scalar1 == tangent.fX) { |
| 98 | results->fSize.set(SkScalarHalf(fIntervals[0]), SkScalarHalf(rec.getWidth())); |
| 99 | } else if (SK_Scalar1 == tangent.fY || -SK_Scalar1 == tangent.fY) { |
| 100 | results->fSize.set(SkScalarHalf(rec.getWidth()), SkScalarHalf(fIntervals[0])); |
| 101 | isXAxis = false; |
| 102 | } else if (SkPaint::kRound_Cap != rec.getCap()) { |
| 103 | // Angled lines don't have axis-aligned boxes. |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 104 | return false; |
| 105 | } |
| 106 | |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 107 | if (results) { |
skia.committer@gmail.com | 7a03d86 | 2012-12-18 02:03:03 +0000 | [diff] [blame] | 108 | results->fFlags = 0; |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 109 | SkScalar clampedInitialDashLength = SkMinScalar(length, fInitialDashLength); |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 110 | |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 111 | if (SkPaint::kRound_Cap == rec.getCap()) { |
| 112 | results->fFlags |= PointData::kCircles_PointFlag; |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 113 | } |
| 114 | |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 115 | results->fNumPoints = 0; |
| 116 | SkScalar len2 = length; |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 117 | if (clampedInitialDashLength > 0 || 0 == fInitialDashIndex) { |
| 118 | SkASSERT(len2 >= clampedInitialDashLength); |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 119 | if (0 == fInitialDashIndex) { |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 120 | if (clampedInitialDashLength > 0) { |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 121 | if (clampedInitialDashLength >= fIntervals[0]) { |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 122 | ++results->fNumPoints; // partial first dash |
| 123 | } |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 124 | len2 -= clampedInitialDashLength; |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 125 | } |
| 126 | len2 -= fIntervals[1]; // also skip first space |
| 127 | if (len2 < 0) { |
| 128 | len2 = 0; |
| 129 | } |
| 130 | } else { |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 131 | len2 -= clampedInitialDashLength; // skip initial partial empty |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 132 | } |
| 133 | } |
| 134 | int numMidPoints = SkScalarFloorToInt(SkScalarDiv(len2, fIntervalLength)); |
| 135 | results->fNumPoints += numMidPoints; |
| 136 | len2 -= numMidPoints * fIntervalLength; |
| 137 | bool partialLast = false; |
| 138 | if (len2 > 0) { |
| 139 | if (len2 < fIntervals[0]) { |
skia.committer@gmail.com | 7a03d86 | 2012-12-18 02:03:03 +0000 | [diff] [blame] | 140 | partialLast = true; |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 141 | } else { |
| 142 | ++numMidPoints; |
| 143 | ++results->fNumPoints; |
| 144 | } |
| 145 | } |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 146 | |
robertphillips@google.com | 935ad02 | 2012-12-05 19:07:21 +0000 | [diff] [blame] | 147 | results->fPoints = new SkPoint[results->fNumPoints]; |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 148 | |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 149 | SkScalar distance = 0; |
| 150 | int curPt = 0; |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 151 | |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 152 | if (clampedInitialDashLength > 0 || 0 == fInitialDashIndex) { |
| 153 | SkASSERT(clampedInitialDashLength <= length); |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 154 | |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 155 | if (0 == fInitialDashIndex) { |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 156 | if (clampedInitialDashLength > 0) { |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 157 | // partial first block |
| 158 | SkASSERT(SkPaint::kRound_Cap != rec.getCap()); // can't handle partial circles |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 159 | SkScalar x = pts[0].fX + SkScalarMul(tangent.fX, SkScalarHalf(clampedInitialDashLength)); |
| 160 | SkScalar y = pts[0].fY + SkScalarMul(tangent.fY, SkScalarHalf(clampedInitialDashLength)); |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 161 | SkScalar halfWidth, halfHeight; |
| 162 | if (isXAxis) { |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 163 | halfWidth = SkScalarHalf(clampedInitialDashLength); |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 164 | halfHeight = SkScalarHalf(rec.getWidth()); |
| 165 | } else { |
| 166 | halfWidth = SkScalarHalf(rec.getWidth()); |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 167 | halfHeight = SkScalarHalf(clampedInitialDashLength); |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 168 | } |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 169 | if (clampedInitialDashLength < fIntervals[0]) { |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 170 | // This one will not be like the others |
| 171 | results->fFirst.addRect(x - halfWidth, y - halfHeight, |
| 172 | x + halfWidth, y + halfHeight); |
| 173 | } else { |
| 174 | SkASSERT(curPt < results->fNumPoints); |
| 175 | results->fPoints[curPt].set(x, y); |
| 176 | ++curPt; |
| 177 | } |
| 178 | |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 179 | distance += clampedInitialDashLength; |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | distance += fIntervals[1]; // skip over the next blank block too |
| 183 | } else { |
robertphillips@google.com | 5c4d558 | 2013-01-15 12:53:31 +0000 | [diff] [blame] | 184 | distance += clampedInitialDashLength; |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 185 | } |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 186 | } |
robertphillips@google.com | 935ad02 | 2012-12-05 19:07:21 +0000 | [diff] [blame] | 187 | |
robertphillips@google.com | 6d87557 | 2012-12-17 18:56:29 +0000 | [diff] [blame] | 188 | if (0 != numMidPoints) { |
| 189 | distance += SkScalarHalf(fIntervals[0]); |
| 190 | |
| 191 | for (int i = 0; i < numMidPoints; ++i) { |
| 192 | SkScalar x = pts[0].fX + SkScalarMul(tangent.fX, distance); |
| 193 | SkScalar y = pts[0].fY + SkScalarMul(tangent.fY, distance); |
| 194 | |
| 195 | SkASSERT(curPt < results->fNumPoints); |
| 196 | results->fPoints[curPt].set(x, y); |
| 197 | ++curPt; |
| 198 | |
| 199 | distance += fIntervalLength; |
| 200 | } |
| 201 | |
| 202 | distance -= SkScalarHalf(fIntervals[0]); |
| 203 | } |
| 204 | |
| 205 | if (partialLast) { |
| 206 | // partial final block |
| 207 | SkASSERT(SkPaint::kRound_Cap != rec.getCap()); // can't handle partial circles |
| 208 | SkScalar temp = length - distance; |
| 209 | SkASSERT(temp < fIntervals[0]); |
| 210 | SkScalar x = pts[0].fX + SkScalarMul(tangent.fX, distance + SkScalarHalf(temp)); |
| 211 | SkScalar y = pts[0].fY + SkScalarMul(tangent.fY, distance + SkScalarHalf(temp)); |
| 212 | SkScalar halfWidth, halfHeight; |
| 213 | if (isXAxis) { |
| 214 | halfWidth = SkScalarHalf(temp); |
| 215 | halfHeight = SkScalarHalf(rec.getWidth()); |
| 216 | } else { |
| 217 | halfWidth = SkScalarHalf(rec.getWidth()); |
| 218 | halfHeight = SkScalarHalf(temp); |
| 219 | } |
| 220 | results->fLast.addRect(x - halfWidth, y - halfHeight, |
| 221 | x + halfWidth, y + halfHeight); |
| 222 | } |
| 223 | |
| 224 | SkASSERT(curPt == results->fNumPoints); |
robertphillips@google.com | 629ab54 | 2012-11-28 17:18:11 +0000 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | return true; |
| 228 | } |
| 229 | |
commit-bot@chromium.org | aec1438 | 2014-04-22 15:21:18 +0000 | [diff] [blame] | 230 | SkPathEffect::DashType SkDashPathEffect::asADash(DashInfo* info) const { |
| 231 | if (info) { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 232 | if (info->fCount >= fCount && info->fIntervals) { |
commit-bot@chromium.org | aec1438 | 2014-04-22 15:21:18 +0000 | [diff] [blame] | 233 | memcpy(info->fIntervals, fIntervals, fCount * sizeof(SkScalar)); |
| 234 | } |
| 235 | info->fCount = fCount; |
| 236 | info->fPhase = fPhase; |
| 237 | } |
| 238 | return kDash_DashType; |
| 239 | } |
| 240 | |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 241 | void SkDashPathEffect::flatten(SkWriteBuffer& buffer) const { |
commit-bot@chromium.org | aec1438 | 2014-04-22 15:21:18 +0000 | [diff] [blame] | 242 | buffer.writeScalar(fPhase); |
djsollen@google.com | c73dd5c | 2012-08-07 15:54:32 +0000 | [diff] [blame] | 243 | buffer.writeScalarArray(fIntervals, fCount); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 244 | } |
| 245 | |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 246 | SkFlattenable* SkDashPathEffect::CreateProc(SkReadBuffer& buffer) { |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 247 | const SkScalar phase = buffer.readScalar(); |
| 248 | uint32_t count = buffer.getArrayCount(); |
| 249 | SkAutoSTArray<32, SkScalar> intervals(count); |
| 250 | if (buffer.readScalarArray(intervals.get(), count)) { |
| 251 | return Create(intervals.get(), SkToInt(count), phase); |
| 252 | } |
| 253 | return NULL; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 254 | } |
| 255 | |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 256 | #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
mtklein | 1c577cd | 2014-07-09 09:54:10 -0700 | [diff] [blame] | 257 | SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer) |
| 258 | : INHERITED(buffer) |
| 259 | , fPhase(0) |
| 260 | , fInitialDashLength(0) |
| 261 | , fInitialDashIndex(0) |
| 262 | , fIntervalLength(0) { |
commit-bot@chromium.org | 7ed173b | 2014-05-20 17:31:08 +0000 | [diff] [blame] | 263 | bool useOldPic = buffer.isVersionLT(SkReadBuffer::kDashWritesPhaseIntervals_Version); |
commit-bot@chromium.org | aec1438 | 2014-04-22 15:21:18 +0000 | [diff] [blame] | 264 | if (useOldPic) { |
| 265 | fInitialDashIndex = buffer.readInt(); |
| 266 | fInitialDashLength = buffer.readScalar(); |
| 267 | fIntervalLength = buffer.readScalar(); |
| 268 | buffer.readBool(); // Dummy for old ScalarToFit field |
| 269 | } else { |
| 270 | fPhase = buffer.readScalar(); |
| 271 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 272 | |
djsollen@google.com | c73dd5c | 2012-08-07 15:54:32 +0000 | [diff] [blame] | 273 | fCount = buffer.getArrayCount(); |
commit-bot@chromium.org | ef74fa1 | 2013-12-17 20:49:46 +0000 | [diff] [blame] | 274 | size_t allocSize = sizeof(SkScalar) * fCount; |
| 275 | if (buffer.validateAvailable(allocSize)) { |
| 276 | fIntervals = (SkScalar*)sk_malloc_throw(allocSize); |
| 277 | buffer.readScalarArray(fIntervals, fCount); |
| 278 | } else { |
| 279 | fIntervals = NULL; |
| 280 | } |
commit-bot@chromium.org | aec1438 | 2014-04-22 15:21:18 +0000 | [diff] [blame] | 281 | |
| 282 | if (useOldPic) { |
| 283 | fPhase = 0; |
commit-bot@chromium.org | 6b3eebc | 2014-05-13 14:45:29 +0000 | [diff] [blame] | 284 | if (fInitialDashLength != -1) { // Signal for bad dash interval |
| 285 | for (int i = 0; i < fInitialDashIndex; ++i) { |
| 286 | fPhase += fIntervals[i]; |
| 287 | } |
| 288 | fPhase += fIntervals[fInitialDashIndex] - fInitialDashLength; |
commit-bot@chromium.org | aec1438 | 2014-04-22 15:21:18 +0000 | [diff] [blame] | 289 | } |
commit-bot@chromium.org | aec1438 | 2014-04-22 15:21:18 +0000 | [diff] [blame] | 290 | } else { |
egdaniel | a22ea18 | 2014-06-11 06:51:51 -0700 | [diff] [blame] | 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 |
mtklein | 1c577cd | 2014-07-09 09:54:10 -0700 | [diff] [blame] | 293 | SkDashPath::CalcDashParameters(fPhase, fIntervals, fCount, |
| 294 | &fInitialDashLength, &fInitialDashIndex, &fIntervalLength); |
commit-bot@chromium.org | aec1438 | 2014-04-22 15:21:18 +0000 | [diff] [blame] | 295 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 296 | } |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 297 | #endif |
| 298 | |