Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: bench/nanobench.cpp

Issue 2069173002: Lots of progress switching to SkColorSpace rather than SkColorProfileType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bad assert Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « bench/nanobench.h ('k') | dm/DM.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } else { 417 } else {
418 SkDebugf("No context was available matching config type and options. \n"); 418 SkDebugf("No context was available matching config type and options. \n");
419 return; 419 return;
420 } 420 }
421 421
422 Config target = { 422 Config target = {
423 gpuConfig->getTag(), 423 gpuConfig->getTag(),
424 Benchmark::kGPU_Backend, 424 Benchmark::kGPU_Backend,
425 kN32_SkColorType, 425 kN32_SkColorType,
426 kPremul_SkAlphaType, 426 kPremul_SkAlphaType,
427 kLinear_SkColorProfileType, 427 nullptr,
428 sampleCount, 428 sampleCount,
429 ctxType, 429 ctxType,
430 ctxOptions, 430 ctxOptions,
431 gpuConfig->getUseDIText() 431 gpuConfig->getUseDIText()
432 }; 432 };
433 433
434 configs->push_back(target); 434 configs->push_back(target);
435 return; 435 return;
436 } 436 }
437 #endif 437 #endif
438 438
439 #define CPU_CONFIG(name, backend, color, alpha, profile) \ 439 #define CPU_CONFIG(name, backend, color, alpha, colorSpace) \
440 if (config->getTag().equals(#name)) { \ 440 if (config->getTag().equals(#name)) { \
441 Config config = { \ 441 Config config = { \
442 SkString(#name), Benchmark::backend, color, alpha, profile, \ 442 SkString(#name), Benchmark::backend, color, alpha, colorSpace, \
443 0, kBogusContextType, kBogusContextOptions, false \ 443 0, kBogusContextType, kBogusContextOptions, false \
444 }; \ 444 }; \
445 configs->push_back(config); \ 445 configs->push_back(config); \
446 return; \ 446 return; \
447 } 447 }
448 448
449 if (FLAGS_cpu) { 449 if (FLAGS_cpu) {
450 CPU_CONFIG(nonrendering, kNonRendering_Backend, 450 CPU_CONFIG(nonrendering, kNonRendering_Backend,
451 kUnknown_SkColorType, kUnpremul_SkAlphaType, kLinear_SkColorP rofileType); 451 kUnknown_SkColorType, kUnpremul_SkAlphaType, nullptr)
452 452
453 CPU_CONFIG(8888, kRaster_Backend, 453 CPU_CONFIG(8888, kRaster_Backend,
454 kN32_SkColorType, kPremul_SkAlphaType, kLinear_SkColorProfile Type) 454 kN32_SkColorType, kPremul_SkAlphaType, nullptr)
455 CPU_CONFIG(565, kRaster_Backend, 455 CPU_CONFIG(565, kRaster_Backend,
456 kRGB_565_SkColorType, kOpaque_SkAlphaType, kLinear_SkColorPro fileType) 456 kRGB_565_SkColorType, kOpaque_SkAlphaType, nullptr)
457 auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
457 CPU_CONFIG(srgb, kRaster_Backend, 458 CPU_CONFIG(srgb, kRaster_Backend,
458 kN32_SkColorType, kPremul_SkAlphaType, kSRGB_SkColorProfileT ype) 459 kN32_SkColorType, kPremul_SkAlphaType, srgbColorSpace)
459 CPU_CONFIG(f16, kRaster_Backend, 460 CPU_CONFIG(f16, kRaster_Backend,
460 kRGBA_F16_SkColorType, kPremul_SkAlphaType, kLinear_SkColorPr ofileType) 461 kRGBA_F16_SkColorType, kPremul_SkAlphaType, nullptr)
461 } 462 }
462 463
463 #undef CPU_CONFIG 464 #undef CPU_CONFIG
464 465
465 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 466 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
466 if (config->getTag().equals("hwui")) { 467 if (config->getTag().equals("hwui")) {
467 Config config = { SkString("hwui"), Benchmark::kHWUI_Backend, 468 Config config = { SkString("hwui"), Benchmark::kHWUI_Backend,
468 kRGBA_8888_SkColorType, kPremul_SkAlphaType, kLinear_S kColorProfileType, 469 kRGBA_8888_SkColorType, kPremul_SkAlphaType, nullptr,
469 0, kBogusContextType, kBogusContextOptions, false }; 470 0, kBogusContextType, kBogusContextOptions, false };
470 configs->push_back(config); 471 configs->push_back(config);
471 } 472 }
472 #endif 473 #endif
473 } 474 }
474 475
475 // Append all configs that are enabled and supported. 476 // Append all configs that are enabled and supported.
476 void create_configs(SkTArray<Config>* configs) { 477 void create_configs(SkTArray<Config>* configs) {
477 SkCommandLineConfigArray array; 478 SkCommandLineConfigArray array;
478 ParseConfigs(FLAGS_config, &array); 479 ParseConfigs(FLAGS_config, &array);
479 for (int i = 0; i < array.count(); ++i) { 480 for (int i = 0; i < array.count(); ++i) {
480 create_config(array[i], configs); 481 create_config(array[i], configs);
481 } 482 }
482 } 483 }
483 484
484 // If bench is enabled for config, returns a Target* for it, otherwise nullptr. 485 // If bench is enabled for config, returns a Target* for it, otherwise nullptr.
485 static Target* is_enabled(Benchmark* bench, const Config& config) { 486 static Target* is_enabled(Benchmark* bench, const Config& config) {
486 if (!bench->isSuitableFor(config.backend)) { 487 if (!bench->isSuitableFor(config.backend)) {
487 return nullptr; 488 return nullptr;
488 } 489 }
489 490
490 SkImageInfo info = SkImageInfo::Make(bench->getSize().fX, bench->getSize().f Y, 491 SkImageInfo info = SkImageInfo::Make(bench->getSize().fX, bench->getSize().f Y,
491 config.color, config.alpha, config.prof ile); 492 config.color, config.alpha, config.colo rSpace);
492 493
493 Target* target = nullptr; 494 Target* target = nullptr;
494 495
495 switch (config.backend) { 496 switch (config.backend) {
496 #if SK_SUPPORT_GPU 497 #if SK_SUPPORT_GPU
497 case Benchmark::kGPU_Backend: 498 case Benchmark::kGPU_Backend:
498 target = new GPUTarget(config); 499 target = new GPUTarget(config);
499 break; 500 break;
500 #endif 501 #endif
501 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 502 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 1288
1288 return 0; 1289 return 0;
1289 } 1290 }
1290 1291
1291 #if !defined SK_BUILD_FOR_IOS 1292 #if !defined SK_BUILD_FOR_IOS
1292 int main(int argc, char** argv) { 1293 int main(int argc, char** argv) {
1293 SkCommandLineFlags::Parse(argc, argv); 1294 SkCommandLineFlags::Parse(argc, argv);
1294 return nanobench_main(); 1295 return nanobench_main();
1295 } 1296 }
1296 #endif 1297 #endif
OLDNEW
« no previous file with comments | « bench/nanobench.h ('k') | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698