| OLD | NEW |
| 1 #if !SK_SUPPORT_GPU | 1 #if !SK_SUPPORT_GPU |
| 2 #error "GPU support required" | 2 #error "GPU support required" |
| 3 #endif | 3 #endif |
| 4 | 4 |
| 5 #include "GrContext.h" | 5 #include "GrContext.h" |
| 6 #include "GrContextFactory.h" | 6 #include "GrContextFactory.h" |
| 7 #include "GrRenderTarget.h" | 7 #include "GrRenderTarget.h" |
| 8 #include "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
| 9 #include "gl/GrGLDefines.h" | 9 #include "gl/GrGLDefines.h" |
| 10 | 10 |
| 11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
| 12 #include "SkColor.h" | 12 #include "SkColor.h" |
| 13 #include "SkDevice.h" | 13 #include "SkDevice.h" |
| 14 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
| 15 #include "SkGraphics.h" | 15 #include "SkGraphics.h" |
| 16 #include "SkImageDecoder.h" | 16 #include "SkImageDecoder.h" |
| 17 #include "SkImageEncoder.h" | 17 #include "SkImageEncoder.h" |
| 18 #include "SkStream.h" | 18 #include "SkStream.h" |
| 19 #include "SkOSFile.h" | 19 #include "SkOSFile.h" |
| 20 #include "SkPicture.h" | 20 #include "SkPicture.h" |
| 21 #include "SkRTConf.h" | 21 #include "SkRTConf.h" |
| 22 #include "SkRunnable.h" | 22 #include "SkRunnable.h" |
| 23 #include "SkString.h" | 23 #include "SkString.h" |
| 24 #include "SkTArray.h" | 24 #include "SkTArray.h" |
| 25 #include "SkTDArray.h" | 25 #include "SkTDArray.h" |
| 26 #include "SkThreadPool.h" | 26 #include "SkThreadPool.h" |
| 27 #include "SkTime.h" | 27 #include "SkTime.h" |
| 28 #include "Test.h" | 28 #include "Test.h" |
| 29 #include "TestClassDef.h" |
| 29 | 30 |
| 30 #ifdef SK_BUILD_FOR_WIN | 31 #ifdef SK_BUILD_FOR_WIN |
| 31 #define PATH_SLASH "\\" | 32 #define PATH_SLASH "\\" |
| 32 #define IN_DIR "D:\\9-30-13\\" | 33 #define IN_DIR "D:\\9-30-13\\" |
| 33 #define OUT_DIR "D:\\skpSkGr\\11\\" | 34 #define OUT_DIR "D:\\skpSkGr\\11\\" |
| 34 #define LINE_FEED "\r\n" | 35 #define LINE_FEED "\r\n" |
| 35 #else | 36 #else |
| 36 #define PATH_SLASH "/" | 37 #define PATH_SLASH "/" |
| 37 #define IN_DIR "/usr/local/google/home/caryclark" PATH_SLASH "9-30-13-skp" | 38 #define IN_DIR "/usr/local/google/home/caryclark" PATH_SLASH "9-30-13-skp" |
| 38 #define OUT_DIR "/media/01CD75512A7F9EE0/4" PATH_SLASH | 39 #define OUT_DIR "/media/01CD75512A7F9EE0/4" PATH_SLASH |
| 39 #define LINE_FEED \n" | 40 #define LINE_FEED "\n" |
| 40 #endif | 41 #endif |
| 41 | 42 |
| 42 #define PATH_STR_SIZE 512 | 43 #define PATH_STR_SIZE 512 |
| 43 | 44 |
| 44 static const struct { | 45 static const struct { |
| 45 int directory; | 46 int directory; |
| 46 const char* filename; | 47 const char* filename; |
| 47 } skipOverSkGr[] = { | 48 } skipOverSkGr[] = { |
| 48 {1, "http___accuweather_com_.skp"}, // Couldn't convert bitmap to texture.h
ttp___absoku072_com_ | 49 {1, "http___accuweather_com_.skp"}, // Couldn't convert bitmap to texture.h
ttp___absoku072_com_ |
| 49 }; | 50 }; |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 }; | 566 }; |
| 566 | 567 |
| 567 static bool initTest() { | 568 static bool initTest() { |
| 568 #if !defined SK_BUILD_FOR_WIN && !defined SK_BUILD_FOR_MAC | 569 #if !defined SK_BUILD_FOR_WIN && !defined SK_BUILD_FOR_MAC |
| 569 SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true); | 570 SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true); |
| 570 SK_CONF_SET("images.png.suppressDecoderWarnings", true); | 571 SK_CONF_SET("images.png.suppressDecoderWarnings", true); |
| 571 #endif | 572 #endif |
| 572 return make_out_dirs(); | 573 return make_out_dirs(); |
| 573 } | 574 } |
| 574 | 575 |
| 575 static void SkpSkGrTest(skiatest::Reporter* reporter) { | 576 DEF_TEST(SkpSkGr, reporter) { |
| 576 SkTArray<TestResult, true> errors; | 577 SkTArray<TestResult, true> errors; |
| 577 if (!initTest()) { | 578 if (!initTest()) { |
| 578 return; | 579 return; |
| 579 } | 580 } |
| 580 SkpSkGrThreadState state; | 581 SkpSkGrThreadState state; |
| 581 state.init(0); | 582 state.init(0); |
| 582 int smallCount = 0; | 583 int smallCount = 0; |
| 583 for (int dirNo = 1; dirNo <= 100; ++dirNo) { | 584 for (int dirNo = 1; dirNo <= 100; ++dirNo) { |
| 584 SkString pictDir = make_in_dir_name(dirNo); | 585 SkString pictDir = make_in_dir_name(dirNo); |
| 585 SkASSERT(pictDir.size()); | 586 SkASSERT(pictDir.size()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 } else if (++smallCount > 10000) { | 622 } else if (++smallCount > 10000) { |
| 622 goto breakOut; | 623 goto breakOut; |
| 623 } | 624 } |
| 624 } | 625 } |
| 625 ++testCount; | 626 ++testCount; |
| 626 if (reporter->verbose()) { | 627 if (reporter->verbose()) { |
| 627 if (testCount % 100 == 0) { | 628 if (testCount % 100 == 0) { |
| 628 SkDebugf("#%d\n", testCount); | 629 SkDebugf("#%d\n", testCount); |
| 629 } | 630 } |
| 630 } | 631 } |
| 631 skipOver: | 632 skipOver: |
| 632 reporter->bumpTestCount(); | 633 reporter->bumpTestCount(); |
| 633 checkEarlyExit: | 634 checkEarlyExit: |
| 634 if (1 && testCount == 20) { | 635 if (1 && testCount == 20) { |
| 635 break; | 636 break; |
| 636 } | 637 } |
| 637 } | 638 } |
| 638 } | 639 } |
| 639 breakOut: | 640 breakOut: |
| 640 if (reporter->verbose()) { | 641 if (reporter->verbose()) { |
| 641 for (int index = 0; index < state.fFoundCount; ++index) { | 642 for (int index = 0; index < state.fFoundCount; ++index) { |
| 642 SkDebugf("%d %s %d\n", state.fDirsFound[index], state.fFilesFound[in
dex], | 643 SkDebugf("%d %s %d\n", state.fDirsFound[index], state.fFilesFound[in
dex], |
| (...skipping 19 matching lines...) Expand all Loading... |
| 662 } | 663 } |
| 663 } | 664 } |
| 664 } | 665 } |
| 665 | 666 |
| 666 static void testSkGrMain(SkpSkGrThreadState* data) { | 667 static void testSkGrMain(SkpSkGrThreadState* data) { |
| 667 data->fResult.testOne(); | 668 data->fResult.testOne(); |
| 668 bumpCount(data->fReporter, false); | 669 bumpCount(data->fReporter, false); |
| 669 data->fReporter->bumpTestCount(); | 670 data->fReporter->bumpTestCount(); |
| 670 } | 671 } |
| 671 | 672 |
| 672 static void SkpSkGrThreadedTest(skiatest::Reporter* reporter) { | 673 DEF_TEST(SkpSkGrThreaded, reporter) { |
| 673 if (!initTest()) { | 674 if (!initTest()) { |
| 674 return; | 675 return; |
| 675 } | 676 } |
| 676 int threadCount = reporter->allowThreaded() ? 3 : 1; | 677 int threadCount = reporter->allowThreaded() ? 3 : 1; |
| 677 SkpSkGrThreadedTestRunner testRunner(reporter, threadCount); | 678 SkpSkGrThreadedTestRunner testRunner(reporter, threadCount); |
| 678 for (int dirIndex = 1; dirIndex <= 100; ++dirIndex) { | 679 for (int dirIndex = 1; dirIndex <= 100; ++dirIndex) { |
| 679 SkString pictDir = make_in_dir_name(dirIndex); | 680 SkString pictDir = make_in_dir_name(dirIndex); |
| 680 if (pictDir.size() == 0) { | 681 if (pictDir.size() == 0) { |
| 681 continue; | 682 continue; |
| 682 } | 683 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 TestResult encoder; | 730 TestResult encoder; |
| 730 encoder.fTestStep = kEncodeFiles; | 731 encoder.fTestStep = kEncodeFiles; |
| 731 for (int index = 0; index < max.fFoundCount; ++index) { | 732 for (int index = 0; index < max.fFoundCount; ++index) { |
| 732 encoder.fDirNo = max.fDirsFound[index]; | 733 encoder.fDirNo = max.fDirsFound[index]; |
| 733 strcpy(encoder.fFilename, max.fFilesFound[index]); | 734 strcpy(encoder.fFilename, max.fFilesFound[index]); |
| 734 encoder.testOne(); | 735 encoder.testOne(); |
| 735 SkDebugf("+"); | 736 SkDebugf("+"); |
| 736 } | 737 } |
| 737 } | 738 } |
| 738 | 739 |
| 739 static void SkpSkGrOneOffTest(skiatest::Reporter* reporter) { | 740 DEF_TEST(SkpSkGrOneOff, reporter) { |
| 740 if (!initTest()) { | 741 if (!initTest()) { |
| 741 return; | 742 return; |
| 742 } | 743 } |
| 743 int testIndex = 166; | 744 int testIndex = 166; |
| 744 int dirIndex = skipOverSkGr[testIndex - 166].directory; | 745 int dirIndex = skipOverSkGr[testIndex - 166].directory; |
| 745 SkString pictDir = make_in_dir_name(dirIndex); | 746 SkString pictDir = make_in_dir_name(dirIndex); |
| 746 if (pictDir.size() == 0) { | 747 if (pictDir.size() == 0) { |
| 747 return; | 748 return; |
| 748 } | 749 } |
| 749 SkString filename(skipOverSkGr[testIndex - 166].filename); | 750 SkString filename(skipOverSkGr[testIndex - 166].filename); |
| 750 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose
()); | 751 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose
()); |
| 751 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose
()); | 752 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose
()); |
| 752 } | 753 } |
| 753 | |
| 754 #include "TestClassDef.h" | |
| 755 DEFINE_TESTCLASS_SHORT(SkpSkGrTest) | |
| 756 | |
| 757 DEFINE_TESTCLASS_SHORT(SkpSkGrOneOffTest) | |
| 758 | |
| 759 DEFINE_TESTCLASS_SHORT(SkpSkGrThreadedTest) | |
| OLD | NEW |