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" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 if (fCount > 0) { | 313 if (fCount > 0) { |
314 fKeySize = buffer.getArrayCount(); | 314 fKeySize = buffer.getArrayCount(); |
315 fPairs = allocatePairStorage(fCount, fKeySize); | 315 fPairs = allocatePairStorage(fCount, fKeySize); |
316 char* keyStorage = (char*)(fPairs + fCount); | 316 char* keyStorage = (char*)(fPairs + fCount); |
317 | 317 |
318 buffer.readByteArray(keyStorage); | 318 buffer.readByteArray(keyStorage); |
319 | 319 |
320 for (int i = 0; i < fCount; ++i) { | 320 for (int i = 0; i < fCount; ++i) { |
321 fPairs[i].fKey = keyStorage; | 321 fPairs[i].fKey = keyStorage; |
322 keyStorage += strlen(keyStorage) + 1; | 322 keyStorage += strlen(keyStorage) + 1; |
323 fPairs[i].fValue = buffer.readFlattenableT<SkData>(); | 323 fPairs[i].fValue = buffer.readData(); |
324 } | 324 } |
325 } else { | 325 } else { |
326 fKeySize = 0; | 326 fKeySize = 0; |
327 fPairs = NULL; | 327 fPairs = NULL; |
328 } | 328 } |
329 } | 329 } |
330 | 330 |
331 SkDataSet* SkDataSet::NewEmpty() { | 331 SkDataSet* SkDataSet::NewEmpty() { |
332 static SkDataSet* gEmptySet; | 332 static SkDataSet* gEmptySet; |
333 if (NULL == gEmptySet) { | 333 if (NULL == gEmptySet) { |
334 gEmptySet = SkNEW_ARGS(SkDataSet, (NULL, 0)); | 334 gEmptySet = SkNEW_ARGS(SkDataSet, (NULL, 0)); |
335 } | 335 } |
336 gEmptySet->ref(); | 336 gEmptySet->ref(); |
337 return gEmptySet; | 337 return gEmptySet; |
338 } | 338 } |
OLD | NEW |