| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 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 |