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

Unified Diff: src/pdf/SkPDFResourceDict.cpp

Issue 1069103003: SkPDF: Refactor SkPDFObject heiararchy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-04-25 (Saturday) 09:40:48 EDT 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | src/pdf/SkPDFTypes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFResourceDict.cpp
diff --git a/src/pdf/SkPDFResourceDict.cpp b/src/pdf/SkPDFResourceDict.cpp
index de5c910c208ead59f70767cd1df219bb69f35aad..1f5bceac9c6e804b7aa15a4518931e68040e4bd4 100644
--- a/src/pdf/SkPDFResourceDict.cpp
+++ b/src/pdf/SkPDFResourceDict.cpp
@@ -46,7 +46,7 @@ static char get_resource_type_prefix(
static const char* get_resource_type_name(
SkPDFResourceDict::SkPDFResourceType type) {
SkASSERT(type >= 0);
- SkASSERT(type < SkPDFResourceDict::kResourceTypeCount);
+ SkASSERT(type < SK_ARRAY_COUNT(resource_type_names));
return resource_type_names[type];
}
@@ -67,13 +67,10 @@ static void add_subdict(
}
SkAutoTUnref<SkPDFDict> resources(SkNEW(SkPDFDict));
for (int i = 0; i < resourceList.count(); i++) {
- SkString keyString = SkPDFResourceDict::getResourceName(type, i);
- SkAutoTUnref<SkPDFName> keyName(SkNEW_ARGS(SkPDFName, (keyString)));
- SkAutoTUnref<SkPDFObjRef> ref(
- SkNEW_ARGS(SkPDFObjRef, (resourceList[i])));
- resources->insert(keyName, ref);
+ resources->insertObjRef(SkPDFResourceDict::getResourceName(type, i),
+ SkRef(resourceList[i]));
}
- dst->insert(get_resource_type_name(type), resources);
+ dst->insertObject(get_resource_type_name(type), resources.detach());
}
SkPDFDict* SkPDFResourceDict::Create(
@@ -90,7 +87,7 @@ SkPDFDict* SkPDFResourceDict::Create(
for (size_t i = 0; i < SK_ARRAY_COUNT(kProcs); i++) {
procSets->appendName(kProcs[i]);
}
- dict->insert("ProcSets", procSets);
+ dict->insertObject("ProcSets", procSets.detach());
if (gStateResources) {
add_subdict(*gStateResources, kExtGState_ResourceType, dict);
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | src/pdf/SkPDFTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698