| 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 "BenchTimer.h" | 8 #include "BenchTimer.h" |
| 9 #include "SkBenchLogger.h" | 9 #include "SkBenchLogger.h" |
| 10 #include "SkBenchmark.h" | 10 #include "SkBenchmark.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 if (-1 != FLAGS_gpuCacheCount) { | 443 if (-1 != FLAGS_gpuCacheCount) { |
| 444 count = FLAGS_gpuCacheCount; | 444 count = FLAGS_gpuCacheCount; |
| 445 } | 445 } |
| 446 context->setTextureCacheLimits(count, bytes); | 446 context->setTextureCacheLimits(count, bytes); |
| 447 #endif | 447 #endif |
| 448 } | 448 } |
| 449 | 449 |
| 450 // Find the longest name of the benches we're going to run to make the outpu
t pretty. | 450 // Find the longest name of the benches we're going to run to make the outpu
t pretty. |
| 451 Iter names; | 451 Iter names; |
| 452 SkBenchmark* bench; | 452 SkBenchmark* bench; |
| 453 int longestName = 0; | 453 size_t longestName = 0; |
| 454 while ((bench = names.next()) != NULL) { | 454 while ((bench = names.next()) != NULL) { |
| 455 SkAutoTUnref<SkBenchmark> benchUnref(bench); | 455 SkAutoTUnref<SkBenchmark> benchUnref(bench); |
| 456 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { | 456 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { |
| 457 continue; | 457 continue; |
| 458 } | 458 } |
| 459 const int length = strlen(bench->getName()); | 459 const size_t length = strlen(bench->getName()); |
| 460 longestName = length > longestName ? length : longestName; | 460 longestName = length > longestName ? length : longestName; |
| 461 } | 461 } |
| 462 | 462 |
| 463 // Run each bench in each configuration it supports and we asked for. | 463 // Run each bench in each configuration it supports and we asked for. |
| 464 Iter iter; | 464 Iter iter; |
| 465 while ((bench = iter.next()) != NULL) { | 465 while ((bench = iter.next()) != NULL) { |
| 466 SkAutoTUnref<SkBenchmark> benchUnref(bench); | 466 SkAutoTUnref<SkBenchmark> benchUnref(bench); |
| 467 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { | 467 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { |
| 468 continue; | 468 continue; |
| 469 } | 469 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 canvas->clear(SK_ColorWHITE); | 539 canvas->clear(SK_ColorWHITE); |
| 540 if (FLAGS_clip) { performClip(canvas, dim.fX, dim.fY); } | 540 if (FLAGS_clip) { performClip(canvas, dim.fX, dim.fY); } |
| 541 if (FLAGS_scale) { performScale(canvas, dim.fX, dim.fY); } | 541 if (FLAGS_scale) { performScale(canvas, dim.fX, dim.fY); } |
| 542 if (FLAGS_rotate) { performRotate(canvas, dim.fX, dim.fY); } | 542 if (FLAGS_rotate) { performRotate(canvas, dim.fX, dim.fY); } |
| 543 } | 543 } |
| 544 | 544 |
| 545 if (!loggedBenchName) { | 545 if (!loggedBenchName) { |
| 546 loggedBenchName = true; | 546 loggedBenchName = true; |
| 547 SkString str; | 547 SkString str; |
| 548 str.printf("running bench [%3d %3d] %*s ", | 548 str.printf("running bench [%3d %3d] %*s ", |
| 549 dim.fX, dim.fY, longestName, bench->getName()); | 549 dim.fX, dim.fY, (int)longestName, bench->getName()); |
| 550 logger.logProgress(str); | 550 logger.logProgress(str); |
| 551 } | 551 } |
| 552 | 552 |
| 553 #if SK_SUPPORT_GPU | 553 #if SK_SUPPORT_GPU |
| 554 SkGLContextHelper* contextHelper = NULL; | 554 SkGLContextHelper* contextHelper = NULL; |
| 555 if (kGPU_Backend == config.backend) { | 555 if (kGPU_Backend == config.backend) { |
| 556 contextHelper = gContextFactory.getGLContext(config.contextType)
; | 556 contextHelper = gContextFactory.getGLContext(config.contextType)
; |
| 557 } | 557 } |
| 558 BenchTimer timer(contextHelper); | 558 BenchTimer timer(contextHelper); |
| 559 #else | 559 #else |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 gContextFactory.destroyContexts(); | 704 gContextFactory.destroyContexts(); |
| 705 #endif | 705 #endif |
| 706 return 0; | 706 return 0; |
| 707 } | 707 } |
| 708 | 708 |
| 709 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 709 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 710 int main(int argc, char * const argv[]) { | 710 int main(int argc, char * const argv[]) { |
| 711 return tool_main(argc, (char**) argv); | 711 return tool_main(argc, (char**) argv); |
| 712 } | 712 } |
| 713 #endif | 713 #endif |
| OLD | NEW |