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

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

Issue 1777923002: SkPDF: use sk_ref_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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/SkPDFGraphicState.cpp ('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 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPDFResourceDict.h" 8 #include "SkPDFResourceDict.h"
9 #include "SkPostConfig.h" 9 #include "SkPostConfig.h"
10 10
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 static void add_subdict( 57 static void add_subdict(
58 const SkTDArray<SkPDFObject*>& resourceList, 58 const SkTDArray<SkPDFObject*>& resourceList,
59 SkPDFResourceDict::SkPDFResourceType type, 59 SkPDFResourceDict::SkPDFResourceType type,
60 SkPDFDict* dst) { 60 SkPDFDict* dst) {
61 if (0 == resourceList.count()) { 61 if (0 == resourceList.count()) {
62 return; 62 return;
63 } 63 }
64 auto resources = sk_make_sp<SkPDFDict>(); 64 auto resources = sk_make_sp<SkPDFDict>();
65 for (int i = 0; i < resourceList.count(); i++) { 65 for (int i = 0; i < resourceList.count(); i++) {
66 resources->insertObjRef(SkPDFResourceDict::getResourceName(type, i), 66 resources->insertObjRef(SkPDFResourceDict::getResourceName(type, i),
67 sk_sp<SkPDFObject>(SkRef(resourceList[i]))); 67 sk_ref_sp(resourceList[i]));
68 } 68 }
69 dst->insertObject(get_resource_type_name(type), std::move(resources)); 69 dst->insertObject(get_resource_type_name(type), std::move(resources));
70 } 70 }
71 71
72 sk_sp<SkPDFDict> SkPDFResourceDict::Make( 72 sk_sp<SkPDFDict> SkPDFResourceDict::Make(
73 const SkTDArray<SkPDFObject*>* gStateResources, 73 const SkTDArray<SkPDFObject*>* gStateResources,
74 const SkTDArray<SkPDFObject*>* patternResources, 74 const SkTDArray<SkPDFObject*>* patternResources,
75 const SkTDArray<SkPDFObject*>* xObjectResources, 75 const SkTDArray<SkPDFObject*>* xObjectResources,
76 const SkTDArray<SkPDFObject*>* fontResources) { 76 const SkTDArray<SkPDFObject*>* fontResources) {
77 auto dict = sk_make_sp<SkPDFDict>(); 77 auto dict = sk_make_sp<SkPDFDict>();
(...skipping 14 matching lines...) Expand all
92 add_subdict(*patternResources, kPattern_ResourceType, dict.get()); 92 add_subdict(*patternResources, kPattern_ResourceType, dict.get());
93 } 93 }
94 if (xObjectResources) { 94 if (xObjectResources) {
95 add_subdict(*xObjectResources, kXObject_ResourceType, dict.get()); 95 add_subdict(*xObjectResources, kXObject_ResourceType, dict.get());
96 } 96 }
97 if (fontResources) { 97 if (fontResources) {
98 add_subdict(*fontResources, kFont_ResourceType, dict.get()); 98 add_subdict(*fontResources, kFont_ResourceType, dict.get());
99 } 99 }
100 return dict; 100 return dict;
101 } 101 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFGraphicState.cpp ('k') | src/pdf/SkPDFShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698