Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(996)

Side by Side Diff: src/effects/SkDashPathEffect.cpp

Issue 1813123003: Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.or… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move flag into sktypes, so it is visible to both paint and other patheffect clients Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkCornerPathEffect.cpp ('k') | src/effects/SkDiscretePathEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 Create(intervals.get(), SkToInt(count), phase); 368 return Make(intervals.get(), SkToInt(count), phase).release();
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 SkPathEffect* SkDashPathEffect::Create(const SkScalar intervals[], int count, Sk Scalar 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 new SkDashPathEffect(intervals, count, phase); 393 return sk_sp<SkPathEffect>(new SkDashPathEffect(intervals, count, phase));
394 } 394 }
OLDNEW
« no previous file with comments | « src/effects/SkCornerPathEffect.cpp ('k') | src/effects/SkDiscretePathEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698