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

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

Issue 1038523004: SkPDF SkPDFObject::addResources signature simplified (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-03-25 (Wednesday) 15:53:41 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/SkPDFCatalog.h ('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 11
12 SkPDFCatalog::SkPDFCatalog() {} 12 SkPDFCatalog::SkPDFCatalog() {}
13 13
14 SkPDFCatalog::~SkPDFCatalog() { 14 SkPDFCatalog::~SkPDFCatalog() {
15 fSubstituteMap.foreach( 15 fSubstituteMap.foreach(
16 [](SkPDFObject*, SkPDFObject** v) { (*v)->unref(); }); 16 [](SkPDFObject*, SkPDFObject** v) { (*v)->unref(); });
17 } 17 }
18 18
19 bool SkPDFCatalog::addObject(SkPDFObject* obj) { 19 bool SkPDFCatalog::addObject(SkPDFObject* obj) {
20 if (fObjectNumbers.find(obj)) { 20 if (fObjectNumbers.find(obj)) {
21 return false; 21 return false;
22 } 22 }
23 fObjectNumbers.set(obj, fObjectNumbers.count() + 1); 23 fObjectNumbers.set(obj, fObjectNumbers.count() + 1);
24 fObjects.push(obj);
24 return true; 25 return true;
25 } 26 }
26 27
27 int32_t SkPDFCatalog::getObjectNumber(SkPDFObject* obj) const { 28 int32_t SkPDFCatalog::getObjectNumber(SkPDFObject* obj) const {
28 int32_t* objectNumberFound = fObjectNumbers.find(obj); 29 int32_t* objectNumberFound = fObjectNumbers.find(obj);
29 SkASSERT(objectNumberFound); 30 SkASSERT(objectNumberFound);
30 return *objectNumberFound; 31 return *objectNumberFound;
31 } 32 }
32 33
33 void SkPDFCatalog::setSubstitute(SkPDFObject* original, 34 void SkPDFCatalog::setSubstitute(SkPDFObject* original,
34 SkPDFObject* substitute) { 35 SkPDFObject* substitute) {
35 SkASSERT(original != substitute); 36 SkASSERT(original != substitute);
36 SkASSERT(!fSubstituteMap.find(original)); 37 SkASSERT(!fSubstituteMap.find(original));
37 fSubstituteMap.set(original, SkRef(substitute)); 38 fSubstituteMap.set(original, SkRef(substitute));
38 } 39 }
39 40
40 SkPDFObject* SkPDFCatalog::getSubstituteObject(SkPDFObject* object) const { 41 SkPDFObject* SkPDFCatalog::getSubstituteObject(SkPDFObject* object) const {
41 SkPDFObject** found = fSubstituteMap.find(object); 42 SkPDFObject** found = fSubstituteMap.find(object);
42 return found ? *found : object; 43 return found ? *found : object;
43 } 44 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFCatalog.h ('k') | src/pdf/SkPDFResourceDict.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698