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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 SkPDFArray* procSets = SkNEW(SkPDFArray()); | 58 SkPDFArray* procSets = SkNEW(SkPDFArray()); |
59 | 59 |
60 procSets->reserve(SK_ARRAY_COUNT(procs)); | 60 procSets->reserve(SK_ARRAY_COUNT(procs)); |
61 for (size_t i = 0; i < SK_ARRAY_COUNT(procs); i++) { | 61 for (size_t i = 0; i < SK_ARRAY_COUNT(procs); i++) { |
62 procSets->appendName(procs[i]); | 62 procSets->appendName(procs[i]); |
63 } | 63 } |
64 insert("ProcSets", procSets)->unref(); | 64 insert("ProcSets", procSets)->unref(); |
65 | 65 |
66 // Actual sub-dicts will be lazily added later | 66 // Actual sub-dicts will be lazily added later |
67 fTypes.setCount(kResourceTypeCount); | 67 fTypes.setCount(kResourceTypeCount); |
68 for (size_t i=0; i < kResourceTypeCount; i++) { | 68 for (int i=0; i < kResourceTypeCount; i++) { |
69 fTypes[i] = NULL; | 69 fTypes[i] = NULL; |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 SkPDFObject* SkPDFResourceDict::insertResourceAsReference( | 73 SkPDFObject* SkPDFResourceDict::insertResourceAsReference( |
74 SkPDFResourceType type, int key, SkPDFObject* value) { | 74 SkPDFResourceType type, int key, SkPDFObject* value) { |
75 SkAutoTUnref<SkPDFObjRef> ref(SkNEW_ARGS(SkPDFObjRef, (value))); | 75 SkAutoTUnref<SkPDFObjRef> ref(SkNEW_ARGS(SkPDFObjRef, (value))); |
76 insertResource(type, key, ref); | 76 insertResource(type, key, ref); |
77 fResources.add(value); | 77 fResources.add(value); |
78 | 78 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 insert(typeName, newDict); // ref counting handled here | 117 insert(typeName, newDict); // ref counting handled here |
118 fTypes[type] = newDict; | 118 fTypes[type] = newDict; |
119 typeDict = newDict.get(); | 119 typeDict = newDict.get(); |
120 } | 120 } |
121 | 121 |
122 SkAutoTUnref<SkPDFName> keyName( | 122 SkAutoTUnref<SkPDFName> keyName( |
123 SkNEW_ARGS(SkPDFName, (getResourceName(type, key)))); | 123 SkNEW_ARGS(SkPDFName, (getResourceName(type, key)))); |
124 typeDict->insert(keyName, value); | 124 typeDict->insert(keyName, value); |
125 return value; | 125 return value; |
126 } | 126 } |
OLD | NEW |