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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 SkString keyString; | 105 SkString keyString; |
106 keyString.printf("%c%d", get_resource_type_prefix(type), key); | 106 keyString.printf("%c%d", get_resource_type_prefix(type), key); |
107 return keyString; | 107 return keyString; |
108 } | 108 } |
109 | 109 |
110 SkPDFObject* SkPDFResourceDict::insertResource( | 110 SkPDFObject* SkPDFResourceDict::insertResource( |
111 SkPDFResourceType type, int key, SkPDFObject* value) { | 111 SkPDFResourceType type, int key, SkPDFObject* value) { |
112 SkPDFDict* typeDict = fTypes[type]; | 112 SkPDFDict* typeDict = fTypes[type]; |
113 if (NULL == typeDict) { | 113 if (NULL == typeDict) { |
114 SkAutoTUnref<SkPDFDict> newDict(SkNEW(SkPDFDict())); | 114 SkAutoTUnref<SkPDFDict> newDict(SkNEW(SkPDFDict())); |
115 SkPDFName* typeName = SkNEW_ARGS( | 115 SkAutoTUnref<SkPDFName> typeName( |
116 SkPDFName, (get_resource_type_name(type))); | 116 SkNEW_ARGS(SkPDFName, (get_resource_type_name(type)))); |
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 SkPDFName* keyName = SkNEW_ARGS(SkPDFName, (getResourceName(type, key))); | 122 SkAutoTUnref<SkPDFName> keyName( |
| 123 SkNEW_ARGS(SkPDFName, (getResourceName(type, key)))); |
123 typeDict->insert(keyName, value); | 124 typeDict->insert(keyName, value); |
124 return value; | 125 return value; |
125 } | 126 } |
OLD | NEW |