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