| 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" |
| 11 #include "SkGeometry.h" | 11 #include "SkGeometry.h" |
| 12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
| 13 #include "SkPath.h" | 13 #include "SkPath.h" |
| 14 #include "SkPDFResourceDict.h" | |
| 15 #include "SkPDFUtils.h" | 14 #include "SkPDFUtils.h" |
| 16 #include "SkStream.h" | 15 #include "SkStream.h" |
| 17 #include "SkString.h" | 16 #include "SkString.h" |
| 18 #include "SkPDFTypes.h" | 17 #include "SkPDFTypes.h" |
| 19 | 18 |
| 20 // static | 19 // static |
| 21 SkPDFArray* SkPDFUtils::MatrixToArray(const SkMatrix& matrix) { | 20 SkPDFArray* SkPDFUtils::MatrixToArray(const SkMatrix& matrix) { |
| 22 SkScalar values[6]; | 21 SkScalar values[6]; |
| 23 if (!matrix.asAffine(values)) { | 22 if (!matrix.asAffine(values)) { |
| 24 SkMatrix::SetAffineIdentity(values); | 23 SkMatrix::SetAffineIdentity(values); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 199 } |
| 201 | 200 |
| 202 // static | 201 // static |
| 203 void SkPDFUtils::StrokePath(SkWStream* content) { | 202 void SkPDFUtils::StrokePath(SkWStream* content) { |
| 204 SkPDFUtils::PaintPath( | 203 SkPDFUtils::PaintPath( |
| 205 SkPaint::kStroke_Style, SkPath::kWinding_FillType, content); | 204 SkPaint::kStroke_Style, SkPath::kWinding_FillType, content); |
| 206 } | 205 } |
| 207 | 206 |
| 208 // static | 207 // static |
| 209 void SkPDFUtils::DrawFormXObject(int objectIndex, SkWStream* content) { | 208 void SkPDFUtils::DrawFormXObject(int objectIndex, SkWStream* content) { |
| 210 content->writeText("/"); | 209 content->writeText("/X"); |
| 211 content->writeText(SkPDFResourceDict::getResourceName( | 210 content->writeDecAsText(objectIndex); |
| 212 SkPDFResourceDict::kXObject_ResourceType, | |
| 213 objectIndex).c_str()); | |
| 214 content->writeText(" Do\n"); | 211 content->writeText(" Do\n"); |
| 215 } | 212 } |
| 216 | 213 |
| 217 // static | 214 // static |
| 218 void SkPDFUtils::ApplyGraphicState(int objectIndex, SkWStream* content) { | 215 void SkPDFUtils::ApplyGraphicState(int objectIndex, SkWStream* content) { |
| 219 content->writeText("/"); | 216 content->writeText("/G"); |
| 220 content->writeText(SkPDFResourceDict::getResourceName( | 217 content->writeDecAsText(objectIndex); |
| 221 SkPDFResourceDict::kExtGState_ResourceType, | |
| 222 objectIndex).c_str()); | |
| 223 content->writeText(" gs\n"); | 218 content->writeText(" gs\n"); |
| 224 } | 219 } |
| OLD | NEW |