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

Side by Side Diff: bench/benchmain.cpp

Issue 329853007: Remove SkBenchmark::postDraw. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: dm too Created 6 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/SkBenchmark.cpp ('k') | dm/DMBenchTask.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 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 "ResultsWriter.h" 9 #include "ResultsWriter.h"
10 #include "SkBenchLogger.h" 10 #include "SkBenchLogger.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 return NULL; 73 return NULL;
74 } 74 }
75 75
76 private: 76 private:
77 const BenchRegistry* fBenches; 77 const BenchRegistry* fBenches;
78 const skiagm::GMRegistry* fGMs; 78 const skiagm::GMRegistry* fGMs;
79 }; 79 };
80 80
81 class AutoPrePostDraw {
82 public:
83 AutoPrePostDraw(SkBenchmark* bench) : fBench(bench) {
84 fBench->preDraw();
85 }
86 ~AutoPrePostDraw() {
87 fBench->postDraw();
88 }
89 private:
90 SkBenchmark* fBench;
91 };
92
93 static void make_filename(const char name[], SkString* path) { 81 static void make_filename(const char name[], SkString* path) {
94 path->set(name); 82 path->set(name);
95 for (int i = 0; name[i]; i++) { 83 for (int i = 0; name[i]; i++) {
96 switch (name[i]) { 84 switch (name[i]) {
97 case '/': 85 case '/':
98 case '\\': 86 case '\\':
99 case ' ': 87 case ' ':
100 case ':': 88 case ':':
101 path->writable_str()[i] = '-'; 89 path->writable_str()[i] = '-';
102 break; 90 break;
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 while ((bench = iter.next()) != NULL) { 443 while ((bench = iter.next()) != NULL) {
456 SkAutoTUnref<SkBenchmark> benchUnref(bench); 444 SkAutoTUnref<SkBenchmark> benchUnref(bench);
457 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) { 445 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getName())) {
458 continue; 446 continue;
459 } 447 }
460 448
461 bench->setForceAlpha(alpha); 449 bench->setForceAlpha(alpha);
462 bench->setForceAA(FLAGS_forceAA); 450 bench->setForceAA(FLAGS_forceAA);
463 bench->setForceFilter(FLAGS_forceFilter); 451 bench->setForceFilter(FLAGS_forceFilter);
464 bench->setDither(dither); 452 bench->setDither(dither);
465 AutoPrePostDraw appd(bench); 453 bench->preDraw();
466 454
467 bool loggedBenchName = false; 455 bool loggedBenchName = false;
468 for (int i = 0; i < configs.count(); ++i) { 456 for (int i = 0; i < configs.count(); ++i) {
469 const int configIndex = configs[i]; 457 const int configIndex = configs[i];
470 const Config& config = gConfigs[configIndex]; 458 const Config& config = gConfigs[configIndex];
471 459
472 if (!bench->isSuitableFor(config.backend)) { 460 if (!bench->isSuitableFor(config.backend)) {
473 continue; 461 continue;
474 } 462 }
475 463
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 gContextFactory.destroyContexts(); 684 gContextFactory.destroyContexts();
697 #endif 685 #endif
698 return 0; 686 return 0;
699 } 687 }
700 688
701 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 689 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
702 int main(int argc, char * const argv[]) { 690 int main(int argc, char * const argv[]) {
703 return tool_main(argc, (char**) argv); 691 return tool_main(argc, (char**) argv);
704 } 692 }
705 #endif 693 #endif
OLDNEW
« no previous file with comments | « bench/SkBenchmark.cpp ('k') | dm/DMBenchTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698