OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 <ctype.h> | 8 #include <ctype.h> |
9 | 9 |
10 #include "nanobench.h" | 10 #include "nanobench.h" |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 476 |
477 // Append all configs that are enabled and supported. | 477 // Append all configs that are enabled and supported. |
478 void create_configs(SkTArray<Config>* configs) { | 478 void create_configs(SkTArray<Config>* configs) { |
479 SkCommandLineConfigArray array; | 479 SkCommandLineConfigArray array; |
480 ParseConfigs(FLAGS_config, &array); | 480 ParseConfigs(FLAGS_config, &array); |
481 for (int i = 0; i < array.count(); ++i) { | 481 for (int i = 0; i < array.count(); ++i) { |
482 create_config(array[i], configs); | 482 create_config(array[i], configs); |
483 } | 483 } |
484 } | 484 } |
485 | 485 |
| 486 // disable warning : switch statement contains default but no 'case' labels |
| 487 #if defined _WIN32 |
| 488 #pragma warning ( push ) |
| 489 #pragma warning ( disable : 4065 ) |
| 490 #endif |
| 491 |
486 // If bench is enabled for config, returns a Target* for it, otherwise nullptr. | 492 // If bench is enabled for config, returns a Target* for it, otherwise nullptr. |
487 static Target* is_enabled(Benchmark* bench, const Config& config) { | 493 static Target* is_enabled(Benchmark* bench, const Config& config) { |
488 if (!bench->isSuitableFor(config.backend)) { | 494 if (!bench->isSuitableFor(config.backend)) { |
489 return nullptr; | 495 return nullptr; |
490 } | 496 } |
491 | 497 |
492 SkImageInfo info = SkImageInfo::Make(bench->getSize().fX, bench->getSize().f
Y, | 498 SkImageInfo info = SkImageInfo::Make(bench->getSize().fX, bench->getSize().f
Y, |
493 config.color, config.alpha, config.colo
rSpace); | 499 config.color, config.alpha, config.colo
rSpace); |
494 | 500 |
495 Target* target = nullptr; | 501 Target* target = nullptr; |
(...skipping 14 matching lines...) Expand all Loading... |
510 break; | 516 break; |
511 } | 517 } |
512 | 518 |
513 if (!target->init(info, bench)) { | 519 if (!target->init(info, bench)) { |
514 delete target; | 520 delete target; |
515 return nullptr; | 521 return nullptr; |
516 } | 522 } |
517 return target; | 523 return target; |
518 } | 524 } |
519 | 525 |
| 526 #if defined _WIN32 |
| 527 #pragma warning ( pop ) |
| 528 #endif |
| 529 |
520 static bool valid_brd_bench(sk_sp<SkData> encoded, SkColorType colorType, uint32
_t sampleSize, | 530 static bool valid_brd_bench(sk_sp<SkData> encoded, SkColorType colorType, uint32
_t sampleSize, |
521 uint32_t minOutputSize, int* width, int* height) { | 531 uint32_t minOutputSize, int* width, int* height) { |
522 SkAutoTDelete<SkBitmapRegionDecoder> brd( | 532 SkAutoTDelete<SkBitmapRegionDecoder> brd( |
523 SkBitmapRegionDecoder::Create(encoded, SkBitmapRegionDecoder::kAndro
idCodec_Strategy)); | 533 SkBitmapRegionDecoder::Create(encoded, SkBitmapRegionDecoder::kAndro
idCodec_Strategy)); |
524 if (nullptr == brd.get()) { | 534 if (nullptr == brd.get()) { |
525 // This is indicates that subset decoding is not supported for a particu
lar image format. | 535 // This is indicates that subset decoding is not supported for a particu
lar image format. |
526 return false; | 536 return false; |
527 } | 537 } |
528 | 538 |
529 if (sampleSize * minOutputSize > (uint32_t) brd->width() || sampleSize * min
OutputSize > | 539 if (sampleSize * minOutputSize > (uint32_t) brd->width() || sampleSize * min
OutputSize > |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 | 1347 |
1338 return 0; | 1348 return 0; |
1339 } | 1349 } |
1340 | 1350 |
1341 #if !defined SK_BUILD_FOR_IOS | 1351 #if !defined SK_BUILD_FOR_IOS |
1342 int main(int argc, char** argv) { | 1352 int main(int argc, char** argv) { |
1343 SkCommandLineFlags::Parse(argc, argv); | 1353 SkCommandLineFlags::Parse(argc, argv); |
1344 return nanobench_main(); | 1354 return nanobench_main(); |
1345 } | 1355 } |
1346 #endif | 1356 #endif |
OLD | NEW |