OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #ifndef PathOpsThreadedCommon_DEFINED | 7 #ifndef PathOpsThreadedCommon_DEFINED |
8 #define PathOpsThreadedCommon_DEFINED | 8 #define PathOpsThreadedCommon_DEFINED |
9 | 9 |
10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
11 #include "SkRunnable.h" | |
12 #include "SkTDArray.h" | 11 #include "SkTDArray.h" |
13 | 12 |
14 #define PATH_STR_SIZE 512 | 13 #define PATH_STR_SIZE 512 |
15 | 14 |
16 class PathOpsThreadedRunnable; | 15 class PathOpsThreadedRunnable; |
17 | 16 |
18 namespace skiatest { | 17 namespace skiatest { |
19 class Reporter; | 18 class Reporter; |
20 } | 19 } |
21 | 20 |
(...skipping 15 matching lines...) Expand all Loading... |
37 | 36 |
38 ~PathOpsThreadedTestRunner(); | 37 ~PathOpsThreadedTestRunner(); |
39 | 38 |
40 void render(); | 39 void render(); |
41 | 40 |
42 public: | 41 public: |
43 SkTDArray<PathOpsThreadedRunnable*> fRunnables; | 42 SkTDArray<PathOpsThreadedRunnable*> fRunnables; |
44 skiatest::Reporter* fReporter; | 43 skiatest::Reporter* fReporter; |
45 }; | 44 }; |
46 | 45 |
47 class PathOpsThreadedRunnable : public SkRunnable { | 46 class PathOpsThreadedRunnable { |
48 public: | 47 public: |
49 PathOpsThreadedRunnable(void (*testFun)(PathOpsThreadState*), int a, int b,
int c, int d, | 48 PathOpsThreadedRunnable(void (*testFun)(PathOpsThreadState*), int a, int b,
int c, int d, |
50 PathOpsThreadedTestRunner* runner) { | 49 PathOpsThreadedTestRunner* runner) { |
51 fState.fA = a; | 50 fState.fA = a; |
52 fState.fB = b; | 51 fState.fB = b; |
53 fState.fC = c; | 52 fState.fC = c; |
54 fState.fD = d; | 53 fState.fD = d; |
55 fState.fReporter = runner->fReporter; | 54 fState.fReporter = runner->fReporter; |
56 fTestFun = testFun; | 55 fTestFun = testFun; |
57 } | 56 } |
58 | 57 |
59 PathOpsThreadedRunnable(void (*testFun)(PathOpsThreadState*), const char* st
r, | 58 PathOpsThreadedRunnable(void (*testFun)(PathOpsThreadState*), const char* st
r, |
60 PathOpsThreadedTestRunner* runner) { | 59 PathOpsThreadedTestRunner* runner) { |
61 SkASSERT(strlen(str) < sizeof(fState.fSerialNo) - 1); | 60 SkASSERT(strlen(str) < sizeof(fState.fSerialNo) - 1); |
62 strcpy(fState.fSerialNo, str); | 61 strcpy(fState.fSerialNo, str); |
63 fState.fReporter = runner->fReporter; | 62 fState.fReporter = runner->fReporter; |
64 fTestFun = testFun; | 63 fTestFun = testFun; |
65 } | 64 } |
66 | 65 |
67 PathOpsThreadedRunnable(void (*testFun)(PathOpsThreadState*), int dirNo, con
st char* str, | 66 PathOpsThreadedRunnable(void (*testFun)(PathOpsThreadState*), int dirNo, con
st char* str, |
68 PathOpsThreadedTestRunner* runner) { | 67 PathOpsThreadedTestRunner* runner) { |
69 SkASSERT(strlen(str) < sizeof(fState.fSerialNo) - 1); | 68 SkASSERT(strlen(str) < sizeof(fState.fSerialNo) - 1); |
70 fState.fA = dirNo; | 69 fState.fA = dirNo; |
71 strcpy(fState.fSerialNo, str); | 70 strcpy(fState.fSerialNo, str); |
72 fState.fReporter = runner->fReporter; | 71 fState.fReporter = runner->fReporter; |
73 fTestFun = testFun; | 72 fTestFun = testFun; |
74 } | 73 } |
75 | 74 |
76 void run() override { | 75 void operator()() { |
77 SkBitmap bitmap; | 76 SkBitmap bitmap; |
78 fState.fBitmap = &bitmap; | 77 fState.fBitmap = &bitmap; |
79 char pathStr[PATH_STR_SIZE]; | 78 char pathStr[PATH_STR_SIZE]; |
80 fState.fPathStr = pathStr; | 79 fState.fPathStr = pathStr; |
81 SkGraphics::SetTLSFontCacheLimit(1 * 1024 * 1024); | 80 SkGraphics::SetTLSFontCacheLimit(1 * 1024 * 1024); |
82 (*fTestFun)(&fState); | 81 (*fTestFun)(&fState); |
83 } | 82 } |
84 | 83 |
85 private: | 84 private: |
86 PathOpsThreadState fState; | 85 PathOpsThreadState fState; |
87 void (*fTestFun)(PathOpsThreadState*); | 86 void (*fTestFun)(PathOpsThreadState*); |
88 }; | 87 }; |
89 | 88 |
90 #endif | 89 #endif |
OLD | NEW |