OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrContext.h" | 8 #include "GrContext.h" |
9 #include "GrContextFactory.h" | 9 #include "GrContextFactory.h" |
10 #include "GrRenderTarget.h" | 10 #include "GrRenderTarget.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 SkGraphics::SetTLSFontCacheLimit(1 * 1024 * 1024); | 157 SkGraphics::SetTLSFontCacheLimit(1 * 1024 * 1024); |
158 (*fTestFun)(&fState); | 158 (*fTestFun)(&fState); |
159 } | 159 } |
160 | 160 |
161 SkpSkGrThreadState fState; | 161 SkpSkGrThreadState fState; |
162 void (*fTestFun)(SkpSkGrThreadState*); | 162 void (*fTestFun)(SkpSkGrThreadState*); |
163 }; | 163 }; |
164 | 164 |
165 SkpSkGrThreadedTestRunner::~SkpSkGrThreadedTestRunner() { | 165 SkpSkGrThreadedTestRunner::~SkpSkGrThreadedTestRunner() { |
166 for (int index = 0; index < fRunnables.count(); index++) { | 166 for (int index = 0; index < fRunnables.count(); index++) { |
167 SkDELETE(fRunnables[index]); | 167 delete fRunnables[index]; |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 void SkpSkGrThreadedTestRunner::render() { | 171 void SkpSkGrThreadedTestRunner::render() { |
172 // TODO: we don't really need to be using SkRunnables here anymore. | 172 // TODO: we don't really need to be using SkRunnables here anymore. |
173 // We can just write the code we'd run right in the for loop. | 173 // We can just write the code we'd run right in the for loop. |
174 sk_parallel_for(fRunnables.count(), [&](int i) { | 174 sk_parallel_for(fRunnables.count(), [&](int i) { |
175 fRunnables[i]->run(); | 175 fRunnables[i]->run(); |
176 }); | 176 }); |
177 } | 177 } |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 int grTime = timePict(pic, &grCanvas); | 470 int grTime = timePict(pic, &grCanvas); |
471 fTime = skTime - grTime; | 471 fTime = skTime - grTime; |
472 } else if (fTestStep == kEncodeFiles) { | 472 } else if (fTestStep == kEncodeFiles) { |
473 SkString pngStr = make_png_name(fFilename); | 473 SkString pngStr = make_png_name(fFilename); |
474 const char* pngName = pngStr.c_str(); | 474 const char* pngName = pngStr.c_str(); |
475 writePict(grBitmap, outGrDir, pngName); | 475 writePict(grBitmap, outGrDir, pngName); |
476 writePict(bitmap, outSkDir, pngName); | 476 writePict(bitmap, outSkDir, pngName); |
477 } | 477 } |
478 } | 478 } |
479 finish: | 479 finish: |
480 SkDELETE(pic); | 480 delete pic; |
481 } | 481 } |
482 | 482 |
483 static SkString makeStatusString(int dirNo) { | 483 static SkString makeStatusString(int dirNo) { |
484 SkString statName; | 484 SkString statName; |
485 statName.printf("stats%d.txt", dirNo); | 485 statName.printf("stats%d.txt", dirNo); |
486 SkString statusFile = make_filepath(0, outStatusDir, statName.c_str()); | 486 SkString statusFile = make_filepath(0, outStatusDir, statName.c_str()); |
487 return statusFile; | 487 return statusFile; |
488 } | 488 } |
489 | 489 |
490 class PreParser { | 490 class PreParser { |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 bumpCount(reporter, true); | 698 bumpCount(reporter, true); |
699 continue; | 699 continue; |
700 } | 700 } |
701 for (size_t index = 0; index < skipOverSkGrCount; ++index) { | 701 for (size_t index = 0; index < skipOverSkGrCount; ++index) { |
702 if (skipOverSkGr[index].directory == dirIndex | 702 if (skipOverSkGr[index].directory == dirIndex |
703 && strcmp(filename.c_str(), skipOverSkGr[index].filename
) == 0) { | 703 && strcmp(filename.c_str(), skipOverSkGr[index].filename
) == 0) { |
704 bumpCount(reporter, true); | 704 bumpCount(reporter, true); |
705 goto skipOver; | 705 goto skipOver; |
706 } | 706 } |
707 } | 707 } |
708 *testRunner.fRunnables.append() = SkNEW_ARGS(SkpSkGrThreadedRunnable
, | 708 *testRunner.fRunnables.append() = new SkpSkGrThreadedRunnable( |
709 (&testSkGrMain, dirIndex, filename.c_str(), &testRunner)); | 709 &testSkGrMain, dirIndex, filename.c_str(), &testRunner); |
710 skipOver: | 710 skipOver: |
711 ; | 711 ; |
712 } | 712 } |
713 } | 713 } |
714 testRunner.render(); | 714 testRunner.render(); |
715 SkpSkGrThreadState& max = testRunner.fRunnables[0]->fState; | 715 SkpSkGrThreadState& max = testRunner.fRunnables[0]->fState; |
716 for (int dirIndex = 2; dirIndex <= 100; ++dirIndex) { | 716 for (int dirIndex = 2; dirIndex <= 100; ++dirIndex) { |
717 SkpSkGrThreadState& state = testRunner.fRunnables[dirIndex - 1]->fState; | 717 SkpSkGrThreadState& state = testRunner.fRunnables[dirIndex - 1]->fState; |
718 for (int index = 0; index < state.fFoundCount; ++index) { | 718 for (int index = 0; index < state.fFoundCount; ++index) { |
719 int maxIdx = max.fFoundCount; | 719 int maxIdx = max.fFoundCount; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 int testIndex = 166; | 751 int testIndex = 166; |
752 int dirIndex = skipOverSkGr[testIndex - 166].directory; | 752 int dirIndex = skipOverSkGr[testIndex - 166].directory; |
753 SkString pictDir = make_in_dir_name(dirIndex); | 753 SkString pictDir = make_in_dir_name(dirIndex); |
754 if (pictDir.size() == 0) { | 754 if (pictDir.size() == 0) { |
755 return; | 755 return; |
756 } | 756 } |
757 SkString filename(skipOverSkGr[testIndex - 166].filename); | 757 SkString filename(skipOverSkGr[testIndex - 166].filename); |
758 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose
()); | 758 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose
()); |
759 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose
()); | 759 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose
()); |
760 } | 760 } |
OLD | NEW |