| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 | 9 |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 } break; | 169 } break; |
| 170 case SkPath::kCubic_Verb: | 170 case SkPath::kCubic_Verb: |
| 171 AppendCubic(args[1].fX, args[1].fY, args[2].fX, args[2].fY, | 171 AppendCubic(args[1].fX, args[1].fY, args[2].fX, args[2].fY, |
| 172 args[3].fX, args[3].fY, ¤tSegment); | 172 args[3].fX, args[3].fY, ¤tSegment); |
| 173 fillState = kNonSingleLine_SkipFillState; | 173 fillState = kNonSingleLine_SkipFillState; |
| 174 break; | 174 break; |
| 175 case SkPath::kClose_Verb: | 175 case SkPath::kClose_Verb: |
| 176 if (fillState != kSingleLine_SkipFillState) { | 176 if (fillState != kSingleLine_SkipFillState) { |
| 177 ClosePath(¤tSegment); | 177 ClosePath(¤tSegment); |
| 178 SkData* data = currentSegment.copyToData(); | 178 currentSegment.writeToStream(content); |
| 179 content->write(data->data(), data->size()); | |
| 180 data->unref(); | |
| 181 } | 179 } |
| 182 currentSegment.reset(); | 180 currentSegment.reset(); |
| 183 break; | 181 break; |
| 184 default: | 182 default: |
| 185 SkASSERT(false); | 183 SkASSERT(false); |
| 186 break; | 184 break; |
| 187 } | 185 } |
| 188 } | 186 } |
| 189 if (currentSegment.bytesWritten() > 0) { | 187 if (currentSegment.bytesWritten() > 0) { |
| 190 SkData* data = currentSegment.copyToData(); | 188 currentSegment.writeToStream(content); |
| 191 content->write(data->data(), data->size()); | |
| 192 data->unref(); | |
| 193 } | 189 } |
| 194 } | 190 } |
| 195 | 191 |
| 196 // static | 192 // static |
| 197 void SkPDFUtils::ClosePath(SkWStream* content) { | 193 void SkPDFUtils::ClosePath(SkWStream* content) { |
| 198 content->writeText("h\n"); | 194 content->writeText("h\n"); |
| 199 } | 195 } |
| 200 | 196 |
| 201 // static | 197 // static |
| 202 void SkPDFUtils::PaintPath(SkPaint::Style style, SkPath::FillType fill, | 198 void SkPDFUtils::PaintPath(SkPaint::Style style, SkPath::FillType fill, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 // color (SCN, scn) | 245 // color (SCN, scn) |
| 250 SkString resourceName = SkPDFResourceDict::getResourceName( | 246 SkString resourceName = SkPDFResourceDict::getResourceName( |
| 251 SkPDFResourceDict::kPattern_ResourceType, | 247 SkPDFResourceDict::kPattern_ResourceType, |
| 252 objectIndex); | 248 objectIndex); |
| 253 content->writeText("/Pattern CS/Pattern cs/"); | 249 content->writeText("/Pattern CS/Pattern cs/"); |
| 254 content->writeText(resourceName.c_str()); | 250 content->writeText(resourceName.c_str()); |
| 255 content->writeText(" SCN/"); | 251 content->writeText(" SCN/"); |
| 256 content->writeText(resourceName.c_str()); | 252 content->writeText(resourceName.c_str()); |
| 257 content->writeText(" scn\n"); | 253 content->writeText(" scn\n"); |
| 258 } | 254 } |
| OLD | NEW |