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

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

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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/SkXfermode.cpp ('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 * 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 8
9 #include "Sk1DPathEffect.h" 9 #include "Sk1DPathEffect.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 SkDEBUGFAIL("unknown verb"); 138 SkDEBUGFAIL("unknown verb");
139 break; 139 break;
140 } 140 }
141 } 141 }
142 } 142 }
143 143
144 SkScalar SkPath1DPathEffect::begin(SkScalar contourLength) const { 144 SkScalar SkPath1DPathEffect::begin(SkScalar contourLength) const {
145 return fInitialOffset; 145 return fInitialOffset;
146 } 146 }
147 147
148 SkFlattenable* SkPath1DPathEffect::CreateProc(SkReadBuffer& buffer) { 148 sk_sp<SkFlattenable> SkPath1DPathEffect::CreateProc(SkReadBuffer& buffer) {
149 SkScalar advance = buffer.readScalar(); 149 SkScalar advance = buffer.readScalar();
150 if (advance > 0) { 150 if (advance > 0) {
151 SkPath path; 151 SkPath path;
152 buffer.readPath(&path); 152 buffer.readPath(&path);
153 SkScalar phase = buffer.readScalar(); 153 SkScalar phase = buffer.readScalar();
154 Style style = (Style)buffer.readUInt(); 154 Style style = (Style)buffer.readUInt();
155 return SkPath1DPathEffect::Make(path, advance, phase, style).release(); 155 return SkPath1DPathEffect::Make(path, advance, phase, style);
156 } 156 }
157 return nullptr; 157 return nullptr;
158 } 158 }
159 159
160 void SkPath1DPathEffect::flatten(SkWriteBuffer& buffer) const { 160 void SkPath1DPathEffect::flatten(SkWriteBuffer& buffer) const {
161 buffer.writeScalar(fAdvance); 161 buffer.writeScalar(fAdvance);
162 if (fAdvance > 0) { 162 if (fAdvance > 0) {
163 buffer.writePath(fPath); 163 buffer.writePath(fPath);
164 buffer.writeScalar(fInitialOffset); 164 buffer.writeScalar(fInitialOffset);
165 buffer.writeUInt(fStyle); 165 buffer.writeUInt(fStyle);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 //////////////////////////////////////////////////////////////////////////////// /////////////////// 204 //////////////////////////////////////////////////////////////////////////////// ///////////////////
205 205
206 sk_sp<SkPathEffect> SkPath1DPathEffect::Make(const SkPath& path, SkScalar advanc e, SkScalar phase, 206 sk_sp<SkPathEffect> SkPath1DPathEffect::Make(const SkPath& path, SkScalar advanc e, SkScalar phase,
207 Style style) { 207 Style style) {
208 if (advance <= 0 || path.isEmpty()) { 208 if (advance <= 0 || path.isEmpty()) {
209 return nullptr; 209 return nullptr;
210 } 210 }
211 return sk_sp<SkPathEffect>(new SkPath1DPathEffect(path, advance, phase, styl e)); 211 return sk_sp<SkPathEffect>(new SkPath1DPathEffect(path, advance, phase, styl e));
212 } 212 }
OLDNEW
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/Sk2DPathEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698