OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |