OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkPDFDevice.h" | 8 #include "SkPDFDevice.h" |
9 | 9 |
10 #include "SkAnnotation.h" | 10 #include "SkAnnotation.h" |
11 #include "SkBitmapDevice.h" | 11 #include "SkBitmapDevice.h" |
| 12 #include "SkClipStack.h" |
12 #include "SkColor.h" | 13 #include "SkColor.h" |
13 #include "SkClipStack.h" | |
14 #include "SkData.h" | 14 #include "SkData.h" |
15 #include "SkDraw.h" | 15 #include "SkDraw.h" |
16 #include "SkGlyphCache.h" | 16 #include "SkGlyphCache.h" |
17 #include "SkImage_Base.h" | 17 #include "SkImage_Base.h" |
18 #include "SkPaint.h" | 18 #include "SkPaint.h" |
19 #include "SkPath.h" | 19 #include "SkPath.h" |
20 #include "SkPathOps.h" | 20 #include "SkPathOps.h" |
21 #include "SkPDFBitmap.h" | 21 #include "SkPDFBitmap.h" |
22 #include "SkPDFFont.h" | 22 #include "SkPDFFont.h" |
23 #include "SkPDFFormXObject.h" | 23 #include "SkPDFFormXObject.h" |
24 #include "SkPDFGraphicState.h" | 24 #include "SkPDFGraphicState.h" |
25 #include "SkPDFResourceDict.h" | 25 #include "SkPDFResourceDict.h" |
26 #include "SkPDFShader.h" | 26 #include "SkPDFShader.h" |
27 #include "SkPDFStream.h" | 27 #include "SkPDFStream.h" |
28 #include "SkPDFTypes.h" | 28 #include "SkPDFTypes.h" |
29 #include "SkPDFUtils.h" | 29 #include "SkPDFUtils.h" |
| 30 #include "SkPaint.h" |
| 31 #include "SkPath.h" |
| 32 #include "SkPathOps.h" |
| 33 #include "SkRRect.h" |
30 #include "SkRect.h" | 34 #include "SkRect.h" |
31 #include "SkRRect.h" | |
32 #include "SkString.h" | 35 #include "SkString.h" |
33 #include "SkSurface.h" | 36 #include "SkSurface.h" |
| 37 #include "SkTSet.h" |
| 38 #include "SkTemplates.h" |
34 #include "SkTextFormatParams.h" | 39 #include "SkTextFormatParams.h" |
35 #include "SkTemplates.h" | |
36 #include "SkTypefacePriv.h" | 40 #include "SkTypefacePriv.h" |
37 #include "SkTSet.h" | |
38 | 41 |
39 #define DPI_FOR_RASTER_SCALE_ONE 72 | 42 #define DPI_FOR_RASTER_SCALE_ONE 72 |
40 | 43 |
41 // Utility functions | 44 // Utility functions |
42 | 45 |
43 static void emit_pdf_color(SkColor color, SkWStream* result) { | 46 static void emit_pdf_color(SkColor color, SkWStream* result) { |
44 SkASSERT(SkColorGetA(color) == 0xFF); // We handle alpha elsewhere. | 47 SkASSERT(SkColorGetA(color) == 0xFF); // We handle alpha elsewhere. |
45 SkScalar colorMax = SkIntToScalar(0xFF); | 48 SkScalar colorMax = SkIntToScalar(0xFF); |
46 SkPDFScalar::Append( | 49 SkPDFScalar::Append( |
47 SkScalarDiv(SkIntToScalar(SkColorGetR(color)), colorMax), result); | 50 SkScalarDiv(SkIntToScalar(SkColorGetR(color)), colorMax), result); |
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2150 return; | 2153 return; |
2151 } | 2154 } |
2152 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap)); | 2155 SkAutoTUnref<SkPDFObject> image(SkPDFBitmap::Create(fCanon, subsetBitmap)); |
2153 if (!image) { | 2156 if (!image) { |
2154 return; | 2157 return; |
2155 } | 2158 } |
2156 | 2159 |
2157 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), | 2160 SkPDFUtils::DrawFormXObject(this->addXObjectResource(image.get()), |
2158 &content.entry()->fContent); | 2161 &content.entry()->fContent); |
2159 } | 2162 } |
OLD | NEW |