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

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

Issue 1033543002: SKPDF: refactor pdfcatalog and pdfdocument (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-03-25 (Wednesday) 14:17:42 EDT Created 5 years, 9 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.cpp ('k') | tests/PDFPrimitivesTest.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 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 "SkPDFTypes.h" 11 #include "SkPDFTypes.h"
12 #include "SkStream.h" 12 #include "SkStream.h"
13 13
14 #ifdef SK_BUILD_FOR_WIN 14 #ifdef SK_BUILD_FOR_WIN
15 #define SNPRINTF _snprintf 15 #define SNPRINTF _snprintf
16 #else 16 #else
17 #define SNPRINTF snprintf 17 #define SNPRINTF snprintf
18 #endif 18 #endif
19 19
20 //////////////////////////////////////////////////////////////////////////////// 20 ////////////////////////////////////////////////////////////////////////////////
21 21
22 SkPDFObjRef::SkPDFObjRef(SkPDFObject* obj) : fObj(obj) { 22 SkPDFObjRef::SkPDFObjRef(SkPDFObject* obj) : fObj(obj) {
23 SkSafeRef(obj); 23 SkSafeRef(obj);
24 } 24 }
25 25
26 SkPDFObjRef::~SkPDFObjRef() {} 26 SkPDFObjRef::~SkPDFObjRef() {}
27 27
28 void SkPDFObjRef::emitObject(SkWStream* stream, SkPDFCatalog* catalog) { 28 void SkPDFObjRef::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
29 stream->writeDecAsText(catalog->getObjectNumber(fObj.get())); 29 SkPDFObject* obj = catalog->getSubstituteObject(fObj);
30 stream->writeDecAsText(catalog->getObjectNumber(obj));
30 stream->writeText(" 0 R"); // Generation number is always 0. 31 stream->writeText(" 0 R"); // Generation number is always 0.
31 } 32 }
32 33
33 void SkPDFObjRef::addResources(SkTSet<SkPDFObject*>* resourceSet, 34 void SkPDFObjRef::addResources(SkTSet<SkPDFObject*>* resourceSet,
34 SkPDFCatalog* catalog) const { 35 SkPDFCatalog* catalog) const {
35 SkPDFObject* obj = catalog->getSubstituteObject(fObj); 36 SkPDFObject* obj = catalog->getSubstituteObject(fObj);
36 SkASSERT(obj); 37 SkASSERT(obj);
37 if (resourceSet->add(obj)) { 38 if (resourceSet->add(obj)) {
38 obj->addResources(resourceSet, catalog); 39 obj->addResources(resourceSet, catalog);
39 } 40 }
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 } 392 }
392 } 393 }
393 } 394 }
394 395
395 void SkPDFDict::mergeFrom(const SkPDFDict& other) { 396 void SkPDFDict::mergeFrom(const SkPDFDict& other) {
396 for (int i = 0; i < other.fValue.count(); i++) { 397 for (int i = 0; i < other.fValue.count(); i++) {
397 *(fValue.append()) = 398 *(fValue.append()) =
398 Rec(SkRef(other.fValue[i].key), SkRef(other.fValue[i].value)); 399 Rec(SkRef(other.fValue[i].key), SkRef(other.fValue[i].value));
399 } 400 }
400 } 401 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFPage.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698