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

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

Issue 19954011: Fix Clang build on SkPDFResourceDict (CL 18977002) (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix style Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/pdf/SkPDFFormXObject.cpp ('k') | src/pdf/SkPDFResourceDict.h » ('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 "SkPDFCatalog.h" 10 #include "SkPDFCatalog.h"
11 #include "SkPDFDevice.h" 11 #include "SkPDFDevice.h"
12 #include "SkPDFPage.h" 12 #include "SkPDFPage.h"
13 #include "SkPDFResourceDict.h"
13 #include "SkStream.h" 14 #include "SkStream.h"
14 15
15 SkPDFPage::SkPDFPage(SkPDFDevice* content) 16 SkPDFPage::SkPDFPage(SkPDFDevice* content)
16 : SkPDFDict("Page"), 17 : SkPDFDict("Page"),
17 fDevice(content) { 18 fDevice(content) {
18 SkSafeRef(content); 19 SkSafeRef(content);
19 } 20 }
20 21
21 SkPDFPage::~SkPDFPage() {} 22 SkPDFPage::~SkPDFPage() {}
22 23
23 void SkPDFPage::finalizePage(SkPDFCatalog* catalog, bool firstPage, 24 void SkPDFPage::finalizePage(SkPDFCatalog* catalog, bool firstPage,
24 const SkTSet<SkPDFObject*>& knownResourceObjects, 25 const SkTSet<SkPDFObject*>& knownResourceObjects,
25 SkTSet<SkPDFObject*>* newResourceObjects) { 26 SkTSet<SkPDFObject*>* newResourceObjects) {
27 SkPDFResourceDict* resourceDict = fDevice->getResourceDict();
26 if (fContentStream.get() == NULL) { 28 if (fContentStream.get() == NULL) {
27 insert("Resources", fDevice->getResourceDict()); 29 insert("Resources", resourceDict);
28 SkSafeUnref(this->insert("MediaBox", fDevice->copyMediaBox())); 30 SkSafeUnref(this->insert("MediaBox", fDevice->copyMediaBox()));
29 if (!SkToBool(catalog->getDocumentFlags() & 31 if (!SkToBool(catalog->getDocumentFlags() &
30 SkPDFDocument::kNoLinks_Flags)) { 32 SkPDFDocument::kNoLinks_Flags)) {
31 SkPDFArray* annots = fDevice->getAnnotations(); 33 SkPDFArray* annots = fDevice->getAnnotations();
32 if (annots && annots->size() > 0) { 34 if (annots && annots->size() > 0) {
33 insert("Annots", annots); 35 insert("Annots", annots);
34 } 36 }
35 } 37 }
36 38
37 SkAutoTUnref<SkStream> content(fDevice->content()); 39 SkAutoTUnref<SkStream> content(fDevice->content());
38 fContentStream.reset(new SkPDFStream(content.get())); 40 fContentStream.reset(new SkPDFStream(content.get()));
39 insert("Contents", new SkPDFObjRef(fContentStream.get()))->unref(); 41 insert("Contents", new SkPDFObjRef(fContentStream.get()))->unref();
40 } 42 }
41 catalog->addObject(fContentStream.get(), firstPage); 43 catalog->addObject(fContentStream.get(), firstPage);
42 fDevice->getResources(knownResourceObjects, newResourceObjects, true); 44 resourceDict->getReferencedResources(knownResourceObjects,
45 newResourceObjects,
46 true);
43 } 47 }
44 48
45 off_t SkPDFPage::getPageSize(SkPDFCatalog* catalog, off_t fileOffset) { 49 off_t SkPDFPage::getPageSize(SkPDFCatalog* catalog, off_t fileOffset) {
46 SkASSERT(fContentStream.get() != NULL); 50 SkASSERT(fContentStream.get() != NULL);
47 catalog->setFileOffset(fContentStream.get(), fileOffset); 51 catalog->setFileOffset(fContentStream.get(), fileOffset);
48 return fContentStream->getOutputSize(catalog, true); 52 return fContentStream->getOutputSize(catalog, true);
49 } 53 }
50 54
51 void SkPDFPage::emitPage(SkWStream* stream, SkPDFCatalog* catalog) { 55 void SkPDFPage::emitPage(SkWStream* stream, SkPDFCatalog* catalog) {
52 SkASSERT(fContentStream.get() != NULL); 56 SkASSERT(fContentStream.get() != NULL);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return fDevice->getFontResources(); 149 return fDevice->getFontResources();
146 } 150 }
147 151
148 const SkPDFGlyphSetMap& SkPDFPage::getFontGlyphUsage() const { 152 const SkPDFGlyphSetMap& SkPDFPage::getFontGlyphUsage() const {
149 return fDevice->getFontGlyphUsage(); 153 return fDevice->getFontGlyphUsage();
150 } 154 }
151 155
152 void SkPDFPage::appendDestinations(SkPDFDict* dict) { 156 void SkPDFPage::appendDestinations(SkPDFDict* dict) {
153 fDevice->appendDestinations(dict, this); 157 fDevice->appendDestinations(dict, this);
154 } 158 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFFormXObject.cpp ('k') | src/pdf/SkPDFResourceDict.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698