| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 if (info->fCount >= fCount && info->fIntervals) { | 349 if (info->fCount >= fCount && info->fIntervals) { |
| 350 memcpy(info->fIntervals, fIntervals, fCount * sizeof(SkScalar)); | 350 memcpy(info->fIntervals, fIntervals, fCount * sizeof(SkScalar)); |
| 351 } | 351 } |
| 352 info->fCount = fCount; | 352 info->fCount = fCount; |
| 353 info->fPhase = fPhase; | 353 info->fPhase = fPhase; |
| 354 } | 354 } |
| 355 return kDash_DashType; | 355 return kDash_DashType; |
| 356 } | 356 } |
| 357 | 357 |
| 358 void SkDashPathEffect::flatten(SkWriteBuffer& buffer) const { | 358 void SkDashPathEffect::flatten(SkWriteBuffer& buffer) const { |
| 359 buffer.writeScalar(fPhase); | 359 buffer.writeScalar("fPhase", fPhase); |
| 360 buffer.writeScalarArray(fIntervals, fCount); | 360 buffer.writeScalarArray("fIntervals", fIntervals, fCount); |
| 361 } | 361 } |
| 362 | 362 |
| 363 sk_sp<SkFlattenable> SkDashPathEffect::CreateProc(SkReadBuffer& buffer) { | 363 sk_sp<SkFlattenable> SkDashPathEffect::CreateProc(SkReadBuffer& buffer) { |
| 364 const SkScalar phase = buffer.readScalar(); | 364 const SkScalar phase = buffer.readScalar(); |
| 365 uint32_t count = buffer.getArrayCount(); | 365 uint32_t count = buffer.getArrayCount(); |
| 366 SkAutoSTArray<32, SkScalar> intervals(count); | 366 SkAutoSTArray<32, SkScalar> intervals(count); |
| 367 if (buffer.readScalarArray(intervals.get(), count)) { | 367 if (buffer.readScalarArray(intervals.get(), count)) { |
| 368 return Make(intervals.get(), SkToInt(count), phase); | 368 return Make(intervals.get(), SkToInt(count), phase); |
| 369 } | 369 } |
| 370 return nullptr; | 370 return nullptr; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 385 #endif | 385 #endif |
| 386 | 386 |
| 387 ////////////////////////////////////////////////////////////////////////////////
////////////////// | 387 ////////////////////////////////////////////////////////////////////////////////
////////////////// |
| 388 | 388 |
| 389 sk_sp<SkPathEffect> SkDashPathEffect::Make(const SkScalar intervals[], int count
, SkScalar phase) { | 389 sk_sp<SkPathEffect> SkDashPathEffect::Make(const SkScalar intervals[], int count
, SkScalar phase) { |
| 390 if (!SkDashPath::ValidDashPath(phase, intervals, count)) { | 390 if (!SkDashPath::ValidDashPath(phase, intervals, count)) { |
| 391 return nullptr; | 391 return nullptr; |
| 392 } | 392 } |
| 393 return sk_sp<SkPathEffect>(new SkDashPathEffect(intervals, count, phase)); | 393 return sk_sp<SkPathEffect>(new SkDashPathEffect(intervals, count, phase)); |
| 394 } | 394 } |
| OLD | NEW |