OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkFlattenableBuffers.h" | 9 #include "SkFlattenableBuffers.h" |
10 #include "SkOSFile.h" | 10 #include "SkOSFile.h" |
11 #include "SkOnce.h" | 11 #include "SkOnce.h" |
12 | 12 |
13 SK_DEFINE_INST_COUNT(SkData) | |
14 | |
15 SkData::SkData(const void* ptr, size_t size, ReleaseProc proc, void* context) { | 13 SkData::SkData(const void* ptr, size_t size, ReleaseProc proc, void* context) { |
16 fPtr = ptr; | 14 fPtr = ptr; |
17 fSize = size; | 15 fSize = size; |
18 fReleaseProc = proc; | 16 fReleaseProc = proc; |
19 fReleaseProcContext = context; | 17 fReleaseProcContext = context; |
20 } | 18 } |
21 | 19 |
22 SkData::~SkData() { | 20 SkData::~SkData() { |
23 if (fReleaseProc) { | 21 if (fReleaseProc) { |
24 fReleaseProc(fPtr, fSize, fReleaseProcContext); | 22 fReleaseProc(fPtr, fSize, fReleaseProcContext); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 SkData* SkData::NewWithCString(const char cstr[]) { | 150 SkData* SkData::NewWithCString(const char cstr[]) { |
153 size_t size; | 151 size_t size; |
154 if (NULL == cstr) { | 152 if (NULL == cstr) { |
155 cstr = ""; | 153 cstr = ""; |
156 size = 1; | 154 size = 1; |
157 } else { | 155 } else { |
158 size = strlen(cstr) + 1; | 156 size = strlen(cstr) + 1; |
159 } | 157 } |
160 return NewWithCopy(cstr, size); | 158 return NewWithCopy(cstr, size); |
161 } | 159 } |
OLD | NEW |