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

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

Issue 1035513003: SkPDF: skpdfdocument and skpdfpage use skpdfdevice in a const way (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 8 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/SkPDFPage.h ('k') | src/pdf/SkPDFShader.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(const 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 SkAutoTUnref<SkPDFResourceDict> deviceResourceDict(
29 fDevice->createResourceDict());
30 this->insert("Resources", deviceResourceDict.get());
29 SkSafeUnref(this->insert("MediaBox", fDevice->copyMediaBox())); 31 SkSafeUnref(this->insert("MediaBox", fDevice->copyMediaBox()));
30 SkPDFArray* annots = fDevice->getAnnotations(); 32 SkPDFArray* annots = fDevice->getAnnotations();
31 if (annots && annots->size() > 0) { 33 if (annots && annots->size() > 0) {
32 insert("Annots", annots); 34 insert("Annots", annots);
33 } 35 }
34 36
35 SkAutoTDelete<SkStreamAsset> content(fDevice->content()); 37 SkAutoTDelete<SkStreamAsset> content(fDevice->content());
36 fContentStream.reset(new SkPDFStream(content.get())); 38 fContentStream.reset(new SkPDFStream(content.get()));
37 insert("Contents", new SkPDFObjRef(fContentStream.get()))->unref(); 39 insert("Contents", new SkPDFObjRef(fContentStream.get()))->unref();
38 } 40 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 return fDevice->getFontGlyphUsage(); 137 return fDevice->getFontGlyphUsage();
136 } 138 }
137 139
138 void SkPDFPage::appendDestinations(SkPDFDict* dict) { 140 void SkPDFPage::appendDestinations(SkPDFDict* dict) {
139 fDevice->appendDestinations(dict, this); 141 fDevice->appendDestinations(dict, this);
140 } 142 }
141 143
142 SkPDFObject* SkPDFPage::getContentStream() const { 144 SkPDFObject* SkPDFPage::getContentStream() const {
143 return fContentStream.get(); 145 return fContentStream.get();
144 } 146 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFPage.h ('k') | src/pdf/SkPDFShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698