Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/pdf/SkPDFPage.cpp

Issue 936403002: PDF: why do we have flags no one uses (or can use)? (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFImage.cpp ('k') | src/pdf/SkPDFStream.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "SkPDFCatalog.h" 11 #include "SkPDFCatalog.h"
12 #include "SkPDFDevice.h" 12 #include "SkPDFDevice.h"
13 #include "SkPDFPage.h" 13 #include "SkPDFPage.h"
14 #include "SkPDFResourceDict.h" 14 #include "SkPDFResourceDict.h"
15 15
16 SkPDFPage::SkPDFPage(SkPDFDevice* content) 16 SkPDFPage::SkPDFPage(SkPDFDevice* content)
17 : SkPDFDict("Page"), 17 : SkPDFDict("Page"),
18 fDevice(content) { 18 fDevice(content) {
19 SkSafeRef(content); 19 SkSafeRef(content);
20 } 20 }
21 21
22 SkPDFPage::~SkPDFPage() {} 22 SkPDFPage::~SkPDFPage() {}
23 23
24 void SkPDFPage::finalizePage(SkPDFCatalog* catalog, bool firstPage, 24 void SkPDFPage::finalizePage(SkPDFCatalog* catalog, bool firstPage,
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 if (!SkToBool(catalog->getDocumentFlags() & 30 SkPDFArray* annots = fDevice->getAnnotations();
31 SkPDFDocument::kNoLinks_Flags)) { 31 if (annots && annots->size() > 0) {
32 SkPDFArray* annots = fDevice->getAnnotations(); 32 insert("Annots", annots);
33 if (annots && annots->size() > 0) {
34 insert("Annots", annots);
35 }
36 } 33 }
37 34
38 SkAutoTUnref<SkData> content(fDevice->copyContentToData()); 35 SkAutoTUnref<SkData> content(fDevice->copyContentToData());
39 fContentStream.reset(new SkPDFStream(content.get())); 36 fContentStream.reset(new SkPDFStream(content.get()));
40 insert("Contents", new SkPDFObjRef(fContentStream.get()))->unref(); 37 insert("Contents", new SkPDFObjRef(fContentStream.get()))->unref();
41 } 38 }
42 catalog->addObject(fContentStream.get(), firstPage); 39 catalog->addObject(fContentStream.get(), firstPage);
43 } 40 }
44 41
45 // static 42 // static
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return fDevice->getFontGlyphUsage(); 135 return fDevice->getFontGlyphUsage();
139 } 136 }
140 137
141 void SkPDFPage::appendDestinations(SkPDFDict* dict) { 138 void SkPDFPage::appendDestinations(SkPDFDict* dict) {
142 fDevice->appendDestinations(dict, this); 139 fDevice->appendDestinations(dict, this);
143 } 140 }
144 141
145 SkPDFObject* SkPDFPage::getContentStream() const { 142 SkPDFObject* SkPDFPage::getContentStream() const {
146 return fContentStream.get(); 143 return fContentStream.get();
147 } 144 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFImage.cpp ('k') | src/pdf/SkPDFStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698