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

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

Issue 1911963008: DNC - JSON of flattenables, with field names. Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add names to call sites 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
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
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); 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", fAdvance);
162 if (fAdvance > 0) { 162 if (fAdvance > 0) {
163 buffer.writePath(fPath); 163 buffer.writePath("fPath", fPath);
164 buffer.writeScalar(fInitialOffset); 164 buffer.writeScalar("fInitialOffset", fInitialOffset);
165 buffer.writeUInt(fStyle); 165 buffer.writeUInt("fStyle", fStyle);
166 } 166 }
167 } 167 }
168 168
169 SkScalar SkPath1DPathEffect::next(SkPath* dst, SkScalar distance, 169 SkScalar SkPath1DPathEffect::next(SkPath* dst, SkScalar distance,
170 SkPathMeasure& meas) const { 170 SkPathMeasure& meas) const {
171 switch (fStyle) { 171 switch (fStyle) {
172 case kTranslate_Style: { 172 case kTranslate_Style: {
173 SkPoint pos; 173 SkPoint pos;
174 if (meas.getPosTan(distance, &pos, nullptr)) { 174 if (meas.getPosTan(distance, &pos, nullptr)) {
175 dst->addPath(fPath, pos.fX, pos.fY); 175 dst->addPath(fPath, pos.fX, pos.fY);
(...skipping 27 matching lines...) Expand all
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

Powered by Google App Engine
This is Rietveld 408576698