| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 362 |
| 363 SkFlattenable* SkDashPathEffect::CreateProc(SkReadBuffer& buffer) { | 363 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 Create(intervals.get(), SkToInt(count), phase); | 368 return Create(intervals.get(), SkToInt(count), phase); |
| 369 } | 369 } |
| 370 return NULL; | 370 return NULL; |
| 371 } | 371 } |
| 372 | |
| 373 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
| 374 SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer) | |
| 375 : INHERITED(buffer) | |
| 376 , fPhase(0) | |
| 377 , fInitialDashLength(0) | |
| 378 , fInitialDashIndex(0) | |
| 379 , fIntervalLength(0) { | |
| 380 fPhase = buffer.readScalar(); | |
| 381 fCount = buffer.getArrayCount(); | |
| 382 size_t allocSize = sizeof(SkScalar) * fCount; | |
| 383 if (buffer.validateAvailable(allocSize)) { | |
| 384 fIntervals = (SkScalar*)sk_malloc_throw(allocSize); | |
| 385 buffer.readScalarArray(fIntervals, fCount); | |
| 386 } else { | |
| 387 fIntervals = NULL; | |
| 388 } | |
| 389 | |
| 390 // set the internal data members, fPhase should have been between 0 and inte
rvalLength | |
| 391 // when written to buffer so no need to adjust it | |
| 392 SkDashPath::CalcDashParameters(fPhase, fIntervals, fCount, | |
| 393 &fInitialDashLength, &fInitialDashIndex, &fIn
tervalLength); | |
| 394 } | |
| 395 #endif | |
| 396 | |
| OLD | NEW |