| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkUtils.h" | 10 #include "SkUtils.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 388 } |
| 389 } else { | 389 } else { |
| 390 char* start = utf8; | 390 char* start = utf8; |
| 391 while (utf16 < stop) { | 391 while (utf16 < stop) { |
| 392 utf8 += SkUTF8_FromUnichar(SkUTF16_NextUnichar(&utf16), utf8); | 392 utf8 += SkUTF8_FromUnichar(SkUTF16_NextUnichar(&utf16), utf8); |
| 393 } | 393 } |
| 394 size = utf8 - start; | 394 size = utf8 - start; |
| 395 } | 395 } |
| 396 return size; | 396 return size; |
| 397 } | 397 } |
| 398 | |
| 399 /////////////////////////////////////////////////////////////////////////////// | |
| 400 | |
| 401 #include <stdlib.h> | |
| 402 | |
| 403 #if 0 | |
| 404 static int round_to_K(size_t bytes) { | |
| 405 return (bytes + 512) >> 10; | |
| 406 } | |
| 407 #endif | |
| 408 | |
| 409 SkAutoMemoryUsageProbe::SkAutoMemoryUsageProbe(const char label[]) | |
| 410 : fLabel(label) { | |
| 411 #if 0 | |
| 412 struct mallinfo mi = mallinfo(); | |
| 413 | |
| 414 fBytesAllocated = mi.uordblks; | |
| 415 #endif | |
| 416 } | |
| 417 | |
| 418 SkAutoMemoryUsageProbe::~SkAutoMemoryUsageProbe() { | |
| 419 #if 0 | |
| 420 struct mallinfo mi = mallinfo(); | |
| 421 | |
| 422 printf("SkAutoMemoryUsageProbe "); | |
| 423 if (fLabel) { | |
| 424 printf("<%s> ", fLabel); | |
| 425 } | |
| 426 printf("delta %dK, current total allocated %dK\n", | |
| 427 round_to_K(mi.uordblks - fBytesAllocated), | |
| 428 round_to_K(mi.uordblks)); | |
| 429 #endif | |
| 430 } | |
| OLD | NEW |