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 "SkImageDiffer.h" | 11 #include "SkImageDiffer.h" |
12 #include "SkMutex.h" | |
13 #include "SkString.h" | 12 #include "SkString.h" |
14 #include "SkTArray.h" | 13 #include "SkTArray.h" |
15 #include "SkTDArray.h" | 14 #include "SkTDArray.h" |
16 #include "SkTLList.h" | 15 #include "SkTLList.h" |
| 16 #include "SkThread.h" |
17 | 17 |
18 class SkWStream; | 18 class SkWStream; |
19 | 19 |
20 /** | 20 /** |
21 * Collects records of diffs and outputs them as JSON. | 21 * Collects records of diffs and outputs them as JSON. |
22 */ | 22 */ |
23 class SkDiffContext { | 23 class SkDiffContext { |
24 public: | 24 public: |
25 SkDiffContext(); | 25 SkDiffContext(); |
26 ~SkDiffContext(); | 26 ~SkDiffContext(); |
(...skipping 18 matching lines...) Expand all Loading... |
45 | 45 |
46 /** | 46 /** |
47 * Sets the directory within which to store whiteDiffs (images showing white | 47 * Sets the directory within which to store whiteDiffs (images showing white |
48 * for each pixel that differs between baseline and test). | 48 * for each pixel that differs between baseline and test). |
49 * | 49 * |
50 * If the directory does not exist yet, it will be created. | 50 * If the directory does not exist yet, it will be created. |
51 */ | 51 */ |
52 void setWhiteDiffDir(const SkString& directory); | 52 void setWhiteDiffDir(const SkString& directory); |
53 | 53 |
54 /** | 54 /** |
55 * Modify the pattern used to generate commonName (= the | 55 * Modify the pattern used to generate commonName (= the |
56 * basename of rgb/white diff files). | 56 * basename of rgb/white diff files). |
57 * | 57 * |
58 * - true: basename is a combination of the input file names. | 58 * - true: basename is a combination of the input file names. |
59 * - false: basename is the common prefix of the input file names. | 59 * - false: basename is the common prefix of the input file names. |
60 * | 60 * |
61 * For example, for: | 61 * For example, for: |
62 * baselinePath=/tmp/dir/image-before.png | 62 * baselinePath=/tmp/dir/image-before.png |
63 * testPath=/tmp/dir/image-after.png | 63 * testPath=/tmp/dir/image-after.png |
64 * | 64 * |
65 * If setLongNames(true), commonName would be: | 65 * If setLongNames(true), commonName would be: |
66 * image-before-png-vs-image-after-png.png | 66 * image-before-png-vs-image-after-png.png |
67 * | 67 * |
68 * If setLongNames(false), commonName would be: | 68 * If setLongNames(false), commonName would be: |
69 * image-.png | 69 * image-.png |
70 */ | 70 */ |
71 void setLongNames(const bool useLongNames); | 71 void setLongNames(const bool useLongNames); |
72 | 72 |
73 /** | 73 /** |
74 * Sets the differs to be used in each diff. Already started diffs will not
retroactively use | 74 * Sets the differs to be used in each diff. Already started diffs will not
retroactively use |
75 * these. | 75 * these. |
76 * @param differs An array of differs to use. The array is copied, but not t
he differs | 76 * @param differs An array of differs to use. The array is copied, but not t
he differs |
77 * themselves. | 77 * themselves. |
(...skipping 19 matching lines...) Expand all Loading... |
97 * @param baselinePath The baseline file path | 97 * @param baselinePath The baseline file path |
98 * @param testPath The matching test file path | 98 * @param testPath The matching test file path |
99 */ | 99 */ |
100 void addDiff(const char* baselinePath, const char* testPath); | 100 void addDiff(const char* baselinePath, const char* testPath); |
101 | 101 |
102 /** | 102 /** |
103 * Output the records of each diff in JSON. | 103 * Output the records of each diff in JSON. |
104 * | 104 * |
105 * The format of the JSON document is one top level array named "records". | 105 * The format of the JSON document is one top level array named "records". |
106 * Each record in the array is an object with the following values: | 106 * Each record in the array is an object with the following values: |
107 * "commonName" : string containing the output filename (basename) | 107 * "commonName" : string containing the output filename (basename) |
108 * depending on the value of 'longNames'. | 108 * depending on the value of 'longNames'. |
109 * (see 'setLongNames' for an explanation and example)
. | 109 * (see 'setLongNames' for an explanation and example)
. |
110 * "baselinePath" : string containing the path to the baseline image | 110 * "baselinePath" : string containing the path to the baseline image |
111 * "testPath" : string containing the path to the test image | 111 * "testPath" : string containing the path to the test image |
112 * "differencePath" : (optional) string containing the path to an alpha | 112 * "differencePath" : (optional) string containing the path to an alpha |
113 * mask of the pixel difference between the baseline | 113 * mask of the pixel difference between the baseline |
114 * and test images | 114 * and test images |
115 * TODO(epoger): consider renaming this "alphaMaskPath
" | 115 * TODO(epoger): consider renaming this "alphaMaskPath
" |
116 * to distinguish from other difference types? | 116 * to distinguish from other difference types? |
117 * "rgbDiffPath" : (optional) string containing the path to a bitmap | 117 * "rgbDiffPath" : (optional) string containing the path to a bitmap |
118 * showing per-channel differences between the | 118 * showing per-channel differences between the |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 int fDifferCount; | 194 int fDifferCount; |
195 int fThreadCount; | 195 int fThreadCount; |
196 | 196 |
197 SkString fAlphaMaskDir; | 197 SkString fAlphaMaskDir; |
198 SkString fRgbDiffDir; | 198 SkString fRgbDiffDir; |
199 SkString fWhiteDiffDir; | 199 SkString fWhiteDiffDir; |
200 bool longNames; | 200 bool longNames; |
201 }; | 201 }; |
202 | 202 |
203 #endif | 203 #endif |
OLD | NEW |