| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 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 #include "SkObjectParser.h" | 9 #include "SkObjectParser.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } else { | 131 } else { |
| 132 mPath->append("isNotRect, "); | 132 mPath->append("isNotRect, "); |
| 133 } | 133 } |
| 134 | 134 |
| 135 mPath->appendS32(path.countVerbs()); | 135 mPath->appendS32(path.countVerbs()); |
| 136 mPath->append("V, "); | 136 mPath->append("V, "); |
| 137 mPath->appendS32(path.countPoints()); | 137 mPath->appendS32(path.countPoints()); |
| 138 mPath->append("P): "); | 138 mPath->append("P): "); |
| 139 | 139 |
| 140 static const char* gVerbStrings[] = { | 140 static const char* gVerbStrings[] = { |
| 141 "Move", "Line", "Quad", "Cubic", "Close", "Done" | 141 "Move", "Line", "Quad", "Conic", "Cubic", "Close", "Done" |
| 142 }; | 142 }; |
| 143 static const int gPtsPerVerb[] = { 1, 1, 2, 3, 0, 0 }; | 143 static const int gPtsPerVerb[] = { 1, 1, 2, 2, 3, 0, 0 }; |
| 144 static const int gPtOffsetPerVerb[] = { 0, 1, 1, 1, 0, 0 }; | 144 static const int gPtOffsetPerVerb[] = { 0, 1, 1, 1, 1, 0, 0 }; |
| 145 SkASSERT(SkPath::kDone_Verb == 5); | 145 SkASSERT(SkPath::kDone_Verb == 6); |
| 146 | 146 |
| 147 SkPath::Iter iter(const_cast<SkPath&>(path), false); | 147 SkPath::Iter iter(const_cast<SkPath&>(path), false); |
| 148 SkPath::Verb verb; | 148 SkPath::Verb verb; |
| 149 SkPoint points[4]; | 149 SkPoint points[4]; |
| 150 | 150 |
| 151 for(verb = iter.next(points, false); | 151 for(verb = iter.next(points, false); |
| 152 verb != SkPath::kDone_Verb; | 152 verb != SkPath::kDone_Verb; |
| 153 verb = iter.next(points, false)) { | 153 verb = iter.next(points, false)) { |
| 154 | 154 |
| 155 mPath->append(gVerbStrings[verb]); | 155 mPath->append(gVerbStrings[verb]); |
| 156 mPath->append(" "); | 156 mPath->append(" "); |
| 157 | 157 |
| 158 for (int i = 0; i < gPtsPerVerb[verb]; ++i) { | 158 for (int i = 0; i < gPtsPerVerb[verb]; ++i) { |
| 159 mPath->append("("); | 159 mPath->append("("); |
| 160 mPath->appendScalar(points[gPtOffsetPerVerb[verb]+i].fX); | 160 mPath->appendScalar(points[gPtOffsetPerVerb[verb]+i].fX); |
| 161 mPath->append(", "); | 161 mPath->append(", "); |
| 162 mPath->appendScalar(points[gPtOffsetPerVerb[verb]+i].fY); | 162 mPath->appendScalar(points[gPtOffsetPerVerb[verb]+i].fY); |
| 163 mPath->append(") "); | 163 mPath->append(")"); |
| 164 } | 164 } |
| 165 |
| 166 if (SkPath::kConic_Verb == verb) { |
| 167 mPath->append("("); |
| 168 mPath->appendScalar(iter.conicWeight()); |
| 169 mPath->append(")"); |
| 170 } |
| 171 |
| 172 mPath->append(" "); |
| 165 } | 173 } |
| 166 | 174 |
| 167 SkString* boundStr = SkObjectParser::RectToString(path.getBounds(), " Bou
nd: "); | 175 SkString* boundStr = SkObjectParser::RectToString(path.getBounds(), " Bou
nd: "); |
| 168 | 176 |
| 169 if (NULL != boundStr) { | 177 if (NULL != boundStr) { |
| 170 mPath->append(*boundStr); | 178 mPath->append(*boundStr); |
| 171 SkDELETE(boundStr); | 179 SkDELETE(boundStr); |
| 172 } | 180 } |
| 173 | 181 |
| 174 return mPath; | 182 return mPath; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 } | 366 } |
| 359 break; | 367 break; |
| 360 } | 368 } |
| 361 default: | 369 default: |
| 362 decodedText->append("Unknown text encoding."); | 370 decodedText->append("Unknown text encoding."); |
| 363 break; | 371 break; |
| 364 } | 372 } |
| 365 | 373 |
| 366 return decodedText; | 374 return decodedText; |
| 367 } | 375 } |
| OLD | NEW |