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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 void SkDashPathEffect::flatten(SkWriteBuffer& buffer) const { | 358 void SkDashPathEffect::flatten(SkWriteBuffer& buffer) const { |
359 buffer.writeScalar(fPhase); | 359 buffer.writeScalar(fPhase); |
360 buffer.writeScalarArray(fIntervals, fCount); | 360 buffer.writeScalarArray(fIntervals, fCount); |
361 } | 361 } |
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 Make(intervals.get(), SkToInt(count), phase).release(); | 368 return Create(intervals.get(), SkToInt(count), phase); |
369 } | 369 } |
370 return nullptr; | 370 return nullptr; |
371 } | 371 } |
372 | 372 |
373 #ifndef SK_IGNORE_TO_STRING | 373 #ifndef SK_IGNORE_TO_STRING |
374 void SkDashPathEffect::toString(SkString* str) const { | 374 void SkDashPathEffect::toString(SkString* str) const { |
375 str->appendf("SkDashPathEffect: ("); | 375 str->appendf("SkDashPathEffect: ("); |
376 str->appendf("count: %d phase %.2f intervals: (", fCount, fPhase); | 376 str->appendf("count: %d phase %.2f intervals: (", fCount, fPhase); |
377 for (int i = 0; i < fCount; ++i) { | 377 for (int i = 0; i < fCount; ++i) { |
378 str->appendf("%.2f", fIntervals[i]); | 378 str->appendf("%.2f", fIntervals[i]); |
379 if (i < fCount-1) { | 379 if (i < fCount-1) { |
380 str->appendf(", "); | 380 str->appendf(", "); |
381 } | 381 } |
382 } | 382 } |
383 str->appendf("))"); | 383 str->appendf("))"); |
384 } | 384 } |
385 #endif | 385 #endif |
386 | 386 |
387 ////////////////////////////////////////////////////////////////////////////////
////////////////// | 387 ////////////////////////////////////////////////////////////////////////////////
////////////////// |
388 | 388 |
389 sk_sp<SkPathEffect> SkDashPathEffect::Make(const SkScalar intervals[], int count
, SkScalar phase) { | 389 SkPathEffect* SkDashPathEffect::Create(const SkScalar intervals[], int count, Sk
Scalar 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 new SkDashPathEffect(intervals, count, phase); |
394 } | 394 } |
OLD | NEW |