| OLD | NEW |
| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 case SkPath::kClose_Verb: | 140 case SkPath::kClose_Verb: |
| 141 dst->close(); | 141 dst->close(); |
| 142 break; | 142 break; |
| 143 default: | 143 default: |
| 144 SkDEBUGFAIL("unknown verb"); | 144 SkDEBUGFAIL("unknown verb"); |
| 145 break; | 145 break; |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 150 SkPath1DPathEffect::SkPath1DPathEffect(SkReadBuffer& buffer) { | 151 SkPath1DPathEffect::SkPath1DPathEffect(SkReadBuffer& buffer) { |
| 151 fAdvance = buffer.readScalar(); | 152 fAdvance = buffer.readScalar(); |
| 152 if (fAdvance > 0) { | 153 if (fAdvance > 0) { |
| 153 buffer.readPath(&fPath); | 154 buffer.readPath(&fPath); |
| 154 fInitialOffset = buffer.readScalar(); | 155 fInitialOffset = buffer.readScalar(); |
| 155 fStyle = (Style) buffer.readUInt(); | 156 fStyle = (Style) buffer.readUInt(); |
| 156 } else { | 157 } else { |
| 157 SkDEBUGF(("SkPath1DPathEffect can't use advance <= 0\n")); | 158 SkDEBUGF(("SkPath1DPathEffect can't use advance <= 0\n")); |
| 158 // Make Coverity happy. | 159 // Make Coverity happy. |
| 159 fInitialOffset = 0; | 160 fInitialOffset = 0; |
| 160 fStyle = kStyleCount; | 161 fStyle = kStyleCount; |
| 161 } | 162 } |
| 162 } | 163 } |
| 164 #endif |
| 163 | 165 |
| 164 SkScalar SkPath1DPathEffect::begin(SkScalar contourLength) const { | 166 SkScalar SkPath1DPathEffect::begin(SkScalar contourLength) const { |
| 165 return fInitialOffset; | 167 return fInitialOffset; |
| 166 } | 168 } |
| 167 | 169 |
| 170 SkFlattenable* SkPath1DPathEffect::CreateProc(SkReadBuffer& buffer) { |
| 171 SkScalar advance = buffer.readScalar(); |
| 172 if (advance > 0) { |
| 173 SkPath path; |
| 174 buffer.readPath(&path); |
| 175 SkScalar phase = buffer.readScalar(); |
| 176 Style style = (Style)buffer.readUInt(); |
| 177 return SkPath1DPathEffect::Create(path, advance, phase, style); |
| 178 } |
| 179 return NULL; |
| 180 } |
| 181 |
| 168 void SkPath1DPathEffect::flatten(SkWriteBuffer& buffer) const { | 182 void SkPath1DPathEffect::flatten(SkWriteBuffer& buffer) const { |
| 169 this->INHERITED::flatten(buffer); | |
| 170 buffer.writeScalar(fAdvance); | 183 buffer.writeScalar(fAdvance); |
| 171 if (fAdvance > 0) { | 184 if (fAdvance > 0) { |
| 172 buffer.writePath(fPath); | 185 buffer.writePath(fPath); |
| 173 buffer.writeScalar(fInitialOffset); | 186 buffer.writeScalar(fInitialOffset); |
| 174 buffer.writeUInt(fStyle); | 187 buffer.writeUInt(fStyle); |
| 175 } | 188 } |
| 176 } | 189 } |
| 177 | 190 |
| 178 SkScalar SkPath1DPathEffect::next(SkPath* dst, SkScalar distance, | 191 SkScalar SkPath1DPathEffect::next(SkPath* dst, SkScalar distance, |
| 179 SkPathMeasure& meas) const { | 192 SkPathMeasure& meas) const { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 192 } break; | 205 } break; |
| 193 case kMorph_Style: | 206 case kMorph_Style: |
| 194 morphpath(dst, fPath, meas, distance); | 207 morphpath(dst, fPath, meas, distance); |
| 195 break; | 208 break; |
| 196 default: | 209 default: |
| 197 SkDEBUGFAIL("unknown Style enum"); | 210 SkDEBUGFAIL("unknown Style enum"); |
| 198 break; | 211 break; |
| 199 } | 212 } |
| 200 return fAdvance; | 213 return fAdvance; |
| 201 } | 214 } |
| OLD | NEW |