| 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 "SkCanvas.h" | 12 #include "SkCanvas.h" |
| 13 #include "SkColor.h" | 13 #include "SkColor.h" |
| 14 #include "SkDevice.h" | 14 #include "SkDevice.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 "SkOSFile.h" | 18 #include "SkOSFile.h" |
| 19 #include "SkPicture.h" | 19 #include "SkPicture.h" |
| 20 #include "SkRTConf.h" | 20 #include "SkRTConf.h" |
| 21 #include "SkRunnable.h" | 21 #include "Runnable.h" |
| 22 #include "SkStream.h" | 22 #include "SkStream.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 "ThreadPool.h" |
| 27 #include "SkTime.h" | 27 #include "SkTime.h" |
| 28 #include "Test.h" | 28 #include "Test.h" |
| 29 | 29 |
| 30 #ifdef SK_BUILD_FOR_WIN | 30 #ifdef SK_BUILD_FOR_WIN |
| 31 #define PATH_SLASH "\\" | 31 #define PATH_SLASH "\\" |
| 32 #define IN_DIR "D:\\9-30-13\\" | 32 #define IN_DIR "D:\\9-30-13\\" |
| 33 #define OUT_DIR "D:\\skpSkGr\\11\\" | 33 #define OUT_DIR "D:\\skpSkGr\\11\\" |
| 34 #define LINE_FEED "\r\n" | 34 #define LINE_FEED "\r\n" |
| 35 #else | 35 #else |
| 36 #define PATH_SLASH "/" | 36 #define PATH_SLASH "/" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 , fReporter(reporter) { | 130 , fReporter(reporter) { |
| 131 } | 131 } |
| 132 | 132 |
| 133 ~SkpSkGrThreadedTestRunner(); | 133 ~SkpSkGrThreadedTestRunner(); |
| 134 void render(); | 134 void render(); |
| 135 int fNumThreads; | 135 int fNumThreads; |
| 136 SkTDArray<SkpSkGrThreadedRunnable*> fRunnables; | 136 SkTDArray<SkpSkGrThreadedRunnable*> fRunnables; |
| 137 skiatest::Reporter* fReporter; | 137 skiatest::Reporter* fReporter; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 class SkpSkGrThreadedRunnable : public SkRunnable { | 140 class SkpSkGrThreadedRunnable : public Runnable { |
| 141 public: | 141 public: |
| 142 SkpSkGrThreadedRunnable(void (*testFun)(SkpSkGrThreadState*), int dirNo, con
st char* str, | 142 SkpSkGrThreadedRunnable(void (*testFun)(SkpSkGrThreadState*), int dirNo, con
st char* str, |
| 143 SkpSkGrThreadedTestRunner* runner) { | 143 SkpSkGrThreadedTestRunner* runner) { |
| 144 SkASSERT(strlen(str) < sizeof(fState.fResult.fFilename) - 1); | 144 SkASSERT(strlen(str) < sizeof(fState.fResult.fFilename) - 1); |
| 145 fState.init(dirNo); | 145 fState.init(dirNo); |
| 146 strcpy(fState.fResult.fFilename, str); | 146 strcpy(fState.fResult.fFilename, str); |
| 147 fState.fReporter = runner->fReporter; | 147 fState.fReporter = runner->fReporter; |
| 148 fTestFun = testFun; | 148 fTestFun = testFun; |
| 149 } | 149 } |
| 150 | 150 |
| 151 virtual void run() SK_OVERRIDE { | 151 virtual void run() SK_OVERRIDE { |
| 152 SkGraphics::SetTLSFontCacheLimit(1 * 1024 * 1024); | 152 SkGraphics::SetTLSFontCacheLimit(1 * 1024 * 1024); |
| 153 (*fTestFun)(&fState); | 153 (*fTestFun)(&fState); |
| 154 } | 154 } |
| 155 | 155 |
| 156 SkpSkGrThreadState fState; | 156 SkpSkGrThreadState fState; |
| 157 void (*fTestFun)(SkpSkGrThreadState*); | 157 void (*fTestFun)(SkpSkGrThreadState*); |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 SkpSkGrThreadedTestRunner::~SkpSkGrThreadedTestRunner() { | 160 SkpSkGrThreadedTestRunner::~SkpSkGrThreadedTestRunner() { |
| 161 for (int index = 0; index < fRunnables.count(); index++) { | 161 for (int index = 0; index < fRunnables.count(); index++) { |
| 162 SkDELETE(fRunnables[index]); | 162 SkDELETE(fRunnables[index]); |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 void SkpSkGrThreadedTestRunner::render() { | 166 void SkpSkGrThreadedTestRunner::render() { |
| 167 SkThreadPool pool(fNumThreads); | 167 ThreadPool pool(fNumThreads); |
| 168 for (int index = 0; index < fRunnables.count(); ++ index) { | 168 for (int index = 0; index < fRunnables.count(); ++ index) { |
| 169 pool.add(fRunnables[index]); | 169 pool.add(fRunnables[index]); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 //////////////////////////////////////////////// | 173 //////////////////////////////////////////////// |
| 174 | 174 |
| 175 static const char outGrDir[] = OUT_DIR "grTest"; | 175 static const char outGrDir[] = OUT_DIR "grTest"; |
| 176 static const char outSkDir[] = OUT_DIR "skTest"; | 176 static const char outSkDir[] = OUT_DIR "skTest"; |
| 177 static const char outSkpDir[] = OUT_DIR "skpTest"; | 177 static const char outSkpDir[] = OUT_DIR "skpTest"; |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 int testIndex = 166; | 746 int testIndex = 166; |
| 747 int dirIndex = skipOverSkGr[testIndex - 166].directory; | 747 int dirIndex = skipOverSkGr[testIndex - 166].directory; |
| 748 SkString pictDir = make_in_dir_name(dirIndex); | 748 SkString pictDir = make_in_dir_name(dirIndex); |
| 749 if (pictDir.size() == 0) { | 749 if (pictDir.size() == 0) { |
| 750 return; | 750 return; |
| 751 } | 751 } |
| 752 SkString filename(skipOverSkGr[testIndex - 166].filename); | 752 SkString filename(skipOverSkGr[testIndex - 166].filename); |
| 753 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose
()); | 753 TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose
()); |
| 754 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose
()); | 754 TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose
()); |
| 755 } | 755 } |
| OLD | NEW |