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 "SkData.h" | 8 #include "SkData.h" |
9 #include "SkDataTable.h" | 9 #include "SkDataTable.h" |
10 | 10 |
11 SK_DEFINE_INST_COUNT(SkDataTable) | |
12 | |
13 static void malloc_freeproc(void* context) { | 11 static void malloc_freeproc(void* context) { |
14 sk_free(context); | 12 sk_free(context); |
15 } | 13 } |
16 | 14 |
17 // Makes empty table | 15 // Makes empty table |
18 SkDataTable::SkDataTable() { | 16 SkDataTable::SkDataTable() { |
19 fCount = 0; | 17 fCount = 0; |
20 fElemSize = 0; // 0 signals that we use fDir instead of fElems | 18 fElemSize = 0; // 0 signals that we use fDir instead of fElems |
21 fU.fDir = NULL; | 19 fU.fDir = NULL; |
22 fFreeProc = NULL; | 20 fFreeProc = NULL; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 memcpy(dir, fDir.begin(), count * sizeof(SkDataTable::Dir)); | 179 memcpy(dir, fDir.begin(), count * sizeof(SkDataTable::Dir)); |
182 | 180 |
183 SkDataTable* table = SkNEW_ARGS(SkDataTable, | 181 SkDataTable* table = SkNEW_ARGS(SkDataTable, |
184 ((SkDataTable::Dir*)dir, count, | 182 ((SkDataTable::Dir*)dir, count, |
185 chunkalloc_freeproc, fHeap)); | 183 chunkalloc_freeproc, fHeap)); |
186 // we have to detach our fHeap, since we are giving that to the table | 184 // we have to detach our fHeap, since we are giving that to the table |
187 fHeap = NULL; | 185 fHeap = NULL; |
188 fDir.reset(); | 186 fDir.reset(); |
189 return table; | 187 return table; |
190 } | 188 } |
OLD | NEW |