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

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

Issue 1813553005: switch patheffects over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: try to fix xpsdevice 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/core/SkReadBuffer.h ('k') | src/effects/Sk2DPathEffect.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "Sk1DPathEffect.h" 10 #include "Sk1DPathEffect.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 return fInitialOffset; 146 return fInitialOffset;
147 } 147 }
148 148
149 SkFlattenable* SkPath1DPathEffect::CreateProc(SkReadBuffer& buffer) { 149 SkFlattenable* SkPath1DPathEffect::CreateProc(SkReadBuffer& buffer) {
150 SkScalar advance = buffer.readScalar(); 150 SkScalar advance = buffer.readScalar();
151 if (advance > 0) { 151 if (advance > 0) {
152 SkPath path; 152 SkPath path;
153 buffer.readPath(&path); 153 buffer.readPath(&path);
154 SkScalar phase = buffer.readScalar(); 154 SkScalar phase = buffer.readScalar();
155 Style style = (Style)buffer.readUInt(); 155 Style style = (Style)buffer.readUInt();
156 return SkPath1DPathEffect::Create(path, advance, phase, style); 156 return SkPath1DPathEffect::Make(path, advance, phase, style).release();
157 } 157 }
158 return nullptr; 158 return nullptr;
159 } 159 }
160 160
161 void SkPath1DPathEffect::flatten(SkWriteBuffer& buffer) const { 161 void SkPath1DPathEffect::flatten(SkWriteBuffer& buffer) const {
162 buffer.writeScalar(fAdvance); 162 buffer.writeScalar(fAdvance);
163 if (fAdvance > 0) { 163 if (fAdvance > 0) {
164 buffer.writePath(fPath); 164 buffer.writePath(fPath);
165 buffer.writeScalar(fInitialOffset); 165 buffer.writeScalar(fInitialOffset);
166 buffer.writeUInt(fStyle); 166 buffer.writeUInt(fStyle);
(...skipping 30 matching lines...) Expand all
197 void SkPath1DPathEffect::toString(SkString* str) const { 197 void SkPath1DPathEffect::toString(SkString* str) const {
198 str->appendf("SkPath1DPathEffect: ("); 198 str->appendf("SkPath1DPathEffect: (");
199 // TODO: add path and style 199 // TODO: add path and style
200 str->appendf("advance: %.2f phase %.2f", fAdvance, fInitialOffset); 200 str->appendf("advance: %.2f phase %.2f", fAdvance, fInitialOffset);
201 str->appendf(")"); 201 str->appendf(")");
202 } 202 }
203 #endif 203 #endif
204 204
205 //////////////////////////////////////////////////////////////////////////////// /////////////////// 205 //////////////////////////////////////////////////////////////////////////////// ///////////////////
206 206
207 SkPathEffect* SkPath1DPathEffect::Create(const SkPath& path, SkScalar advance, S kScalar phase, 207 sk_sp<SkPathEffect> SkPath1DPathEffect::Make(const SkPath& path, SkScalar advanc e, SkScalar phase,
208 Style style) { 208 Style style) {
209 if (advance <= 0 || path.isEmpty()) { 209 if (advance <= 0 || path.isEmpty()) {
210 return nullptr; 210 return nullptr;
211 } 211 }
212 return new SkPath1DPathEffect(path, advance, phase, style); 212 return sk_sp<SkPathEffect>(new SkPath1DPathEffect(path, advance, phase, styl e));
213 } 213 }
OLDNEW
« no previous file with comments | « src/core/SkReadBuffer.h ('k') | src/effects/Sk2DPathEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698