| 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 | 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |