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

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

Issue 1049753002: SkPDF: Factor SkPDFCatalog into SkPDFObjNumMap and SkPDFSubstituteMap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: full 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
OLDNEW
(Empty)
1
2 /*
3 * Copyright 2010 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10 #include "SkPDFCatalog.h"
11
12 SkPDFCatalog::SkPDFCatalog() {}
13
14 SkPDFCatalog::~SkPDFCatalog() {
15 fSubstituteMap.foreach(
16 [](SkPDFObject*, SkPDFObject** v) { (*v)->unref(); });
17 }
18
19 bool SkPDFCatalog::addObject(SkPDFObject* obj) {
20 if (fObjectNumbers.find(obj)) {
21 return false;
22 }
23 fObjectNumbers.set(obj, fObjectNumbers.count() + 1);
24 fObjects.push(obj);
25 return true;
26 }
27
28 int32_t SkPDFCatalog::getObjectNumber(SkPDFObject* obj) const {
29 int32_t* objectNumberFound = fObjectNumbers.find(obj);
30 SkASSERT(objectNumberFound);
31 return *objectNumberFound;
32 }
33
34 void SkPDFCatalog::setSubstitute(SkPDFObject* original,
35 SkPDFObject* substitute) {
36 SkASSERT(original != substitute);
37 SkASSERT(!fSubstituteMap.find(original));
38 fSubstituteMap.set(original, SkRef(substitute));
39 }
40
41 SkPDFObject* SkPDFCatalog::getSubstituteObject(SkPDFObject* object) const {
42 SkPDFObject** found = fSubstituteMap.find(object);
43 return found ? *found : object;
44 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFCatalog.h ('k') | src/pdf/SkPDFFont.h » ('j') | src/pdf/SkPDFStream.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698