OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
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 14 matching lines...) Expand all Loading... |
25 const SkTSet<SkPDFObject*>& knownResourceObjects, | 25 const SkTSet<SkPDFObject*>& knownResourceObjects, |
26 SkTSet<SkPDFObject*>* newResourceObjects) { | 26 SkTSet<SkPDFObject*>* newResourceObjects) { |
27 if (fContentStream.get() == NULL) { | 27 if (fContentStream.get() == NULL) { |
28 this->insert("Resources", fDevice->getResourceDict()); | 28 this->insert("Resources", fDevice->getResourceDict()); |
29 SkSafeUnref(this->insert("MediaBox", fDevice->copyMediaBox())); | 29 SkSafeUnref(this->insert("MediaBox", fDevice->copyMediaBox())); |
30 SkPDFArray* annots = fDevice->getAnnotations(); | 30 SkPDFArray* annots = fDevice->getAnnotations(); |
31 if (annots && annots->size() > 0) { | 31 if (annots && annots->size() > 0) { |
32 insert("Annots", annots); | 32 insert("Annots", annots); |
33 } | 33 } |
34 | 34 |
35 SkAutoTUnref<SkData> content(fDevice->copyContentToData()); | 35 SkAutoTDelete<SkStreamAsset> content(fDevice->content()); |
36 fContentStream.reset(new SkPDFStream(content.get())); | 36 fContentStream.reset(new SkPDFStream(content.get())); |
37 insert("Contents", new SkPDFObjRef(fContentStream.get()))->unref(); | 37 insert("Contents", new SkPDFObjRef(fContentStream.get()))->unref(); |
38 } | 38 } |
39 catalog->addObject(fContentStream.get(), firstPage); | 39 catalog->addObject(fContentStream.get(), firstPage); |
40 } | 40 } |
41 | 41 |
42 // static | 42 // static |
43 void SkPDFPage::GeneratePageTree(const SkTDArray<SkPDFPage*>& pages, | 43 void SkPDFPage::GeneratePageTree(const SkTDArray<SkPDFPage*>& pages, |
44 SkPDFCatalog* catalog, | 44 SkPDFCatalog* catalog, |
45 SkTDArray<SkPDFDict*>* pageTree, | 45 SkTDArray<SkPDFDict*>* pageTree, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 return fDevice->getFontGlyphUsage(); | 135 return fDevice->getFontGlyphUsage(); |
136 } | 136 } |
137 | 137 |
138 void SkPDFPage::appendDestinations(SkPDFDict* dict) { | 138 void SkPDFPage::appendDestinations(SkPDFDict* dict) { |
139 fDevice->appendDestinations(dict, this); | 139 fDevice->appendDestinations(dict, this); |
140 } | 140 } |
141 | 141 |
142 SkPDFObject* SkPDFPage::getContentStream() const { | 142 SkPDFObject* SkPDFPage::getContentStream() const { |
143 return fContentStream.get(); | 143 return fContentStream.get(); |
144 } | 144 } |
OLD | NEW |