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

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

Issue 1029263004: SkPDF: clean up extra references (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-03-23 (Monday) 20:01:49 EDT Created 5 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/SkPDFResourceDict.h ('k') | src/pdf/SkPDFShader.h » ('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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 fTypes.setCount(kResourceTypeCount); 65 fTypes.setCount(kResourceTypeCount);
66 for (int i=0; i < kResourceTypeCount; i++) { 66 for (int i=0; i < kResourceTypeCount; i++) {
67 fTypes[i] = NULL; 67 fTypes[i] = NULL;
68 } 68 }
69 } 69 }
70 70
71 SkPDFObject* SkPDFResourceDict::insertResourceAsReference( 71 SkPDFObject* SkPDFResourceDict::insertResourceAsReference(
72 SkPDFResourceType type, int key, SkPDFObject* value) { 72 SkPDFResourceType type, int key, SkPDFObject* value) {
73 SkAutoTUnref<SkPDFObjRef> ref(SkNEW_ARGS(SkPDFObjRef, (value))); 73 SkAutoTUnref<SkPDFObjRef> ref(SkNEW_ARGS(SkPDFObjRef, (value)));
74 insertResource(type, key, ref); 74 insertResource(type, key, ref);
75 fResources.add(value);
76 75
77 return value; 76 return value;
78 } 77 }
79 78
80 SkString SkPDFResourceDict::getResourceName( 79 SkString SkPDFResourceDict::getResourceName(
81 SkPDFResourceType type, int key) { 80 SkPDFResourceType type, int key) {
82 SkString keyString; 81 SkString keyString;
83 keyString.printf("%c%d", get_resource_type_prefix(type), key); 82 keyString.printf("%c%d", get_resource_type_prefix(type), key);
84 return keyString; 83 return keyString;
85 } 84 }
86 85
87 SkPDFObject* SkPDFResourceDict::insertResource( 86 SkPDFObject* SkPDFResourceDict::insertResource(
88 SkPDFResourceType type, int key, SkPDFObject* value) { 87 SkPDFResourceType type, int key, SkPDFObject* value) {
89 SkPDFDict* typeDict = fTypes[type]; 88 SkPDFDict* typeDict = fTypes[type];
90 if (NULL == typeDict) { 89 if (NULL == typeDict) {
91 SkAutoTUnref<SkPDFDict> newDict(SkNEW(SkPDFDict())); 90 SkAutoTUnref<SkPDFDict> newDict(SkNEW(SkPDFDict()));
92 SkAutoTUnref<SkPDFName> typeName( 91 SkAutoTUnref<SkPDFName> typeName(
93 SkNEW_ARGS(SkPDFName, (get_resource_type_name(type)))); 92 SkNEW_ARGS(SkPDFName, (get_resource_type_name(type))));
94 insert(typeName, newDict); // ref counting handled here 93 insert(typeName, newDict); // ref counting handled here
95 fTypes[type] = newDict; 94 fTypes[type] = newDict;
96 typeDict = newDict.get(); 95 typeDict = newDict.get();
97 } 96 }
98 97
99 SkAutoTUnref<SkPDFName> keyName( 98 SkAutoTUnref<SkPDFName> keyName(
100 SkNEW_ARGS(SkPDFName, (getResourceName(type, key)))); 99 SkNEW_ARGS(SkPDFName, (getResourceName(type, key))));
101 typeDict->insert(keyName, value); 100 typeDict->insert(keyName, value);
102 return value; 101 return value;
103 } 102 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFResourceDict.h ('k') | src/pdf/SkPDFShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698