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 #ifndef SkDiffContext_DEFINED | 8 #ifndef SkDiffContext_DEFINED |
9 #define SkDiffContext_DEFINED | 9 #define SkDiffContext_DEFINED |
10 | 10 |
11 #include "SkString.h" | 11 #include "SkString.h" |
12 #include "SkTArray.h" | 12 #include "SkTArray.h" |
13 #include "SkTDArray.h" | 13 #include "SkTDArray.h" |
14 | 14 |
15 class SkWStream; | 15 class SkWStream; |
16 class SkImageDiffer; | 16 class SkImageDiffer; |
17 | 17 |
18 /** | 18 /** |
19 * Collects records of diffs and outputs them as JSON. | 19 * Collects records of diffs and outputs them as JSON. |
20 */ | 20 */ |
21 class SkDiffContext { | 21 class SkDiffContext { |
22 public: | 22 public: |
23 SkDiffContext(); | 23 SkDiffContext(); |
24 ~SkDiffContext(); | 24 ~SkDiffContext(); |
25 | 25 |
26 void setThreadCount(int threadCount) { fThreadCount = threadCount; } | 26 void setThreadCount(int threadCount) { fThreadCount = threadCount; } |
27 | 27 |
28 /** | 28 /** |
| 29 * Creates the directory if it does not exist and uses it to store differenc
es |
| 30 * between images. |
| 31 */ |
| 32 void setDifferenceDir(const SkString& directory); |
| 33 |
| 34 /** |
29 * Sets the differs to be used in each diff. Already started diffs will not
retroactively use | 35 * Sets the differs to be used in each diff. Already started diffs will not
retroactively use |
30 * these. | 36 * these. |
31 * @param differs An array of differs to use. The array is copied, but not t
he differs | 37 * @param differs An array of differs to use. The array is copied, but not t
he differs |
32 * themselves. | 38 * themselves. |
33 */ | 39 */ |
34 void setDiffers(const SkTDArray<SkImageDiffer*>& differs); | 40 void setDiffers(const SkTDArray<SkImageDiffer*>& differs); |
35 | 41 |
36 /** | 42 /** |
37 * Compares two directories of images with the given differ | 43 * Compares two directories of images with the given differ |
38 * @param baselinePath The baseline directory's path | 44 * @param baselinePath The baseline directory's path |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 105 |
100 | 106 |
101 private: | 107 private: |
102 struct DiffData { | 108 struct DiffData { |
103 const char* fDiffName; | 109 const char* fDiffName; |
104 double fResult; | 110 double fResult; |
105 SkTDArray<SkIPoint> fPointsOfInterest; | 111 SkTDArray<SkIPoint> fPointsOfInterest; |
106 }; | 112 }; |
107 | 113 |
108 struct DiffRecord { | 114 struct DiffRecord { |
| 115 SkString fCommonName; |
109 SkString fDifferencePath; | 116 SkString fDifferencePath; |
110 SkString fBaselinePath; | 117 SkString fBaselinePath; |
111 SkString fTestPath; | 118 SkString fTestPath; |
112 SkTArray<DiffData> fDiffs; | 119 SkTArray<DiffData> fDiffs; |
113 DiffRecord* fNext; | 120 DiffRecord* fNext; |
114 }; | 121 }; |
115 | 122 |
116 // We use linked list for the records so that their pointers remain stable.
A resizable array | 123 // We use linked list for the records so that their pointers remain stable.
A resizable array |
117 // might change its pointers, which would make it harder for async diffs to
record their | 124 // might change its pointers, which would make it harder for async diffs to
record their |
118 // results. | 125 // results. |
119 DiffRecord * fRecords; | 126 DiffRecord * fRecords; |
120 | 127 |
121 SkImageDiffer** fDiffers; | 128 SkImageDiffer** fDiffers; |
122 int fDifferCount; | 129 int fDifferCount; |
123 int fThreadCount; | 130 int fThreadCount; |
| 131 |
| 132 SkString fDifferenceDir; |
124 }; | 133 }; |
125 | 134 |
126 #endif | 135 #endif |
OLD | NEW |