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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |
| 56 * basename of rgb/white diff files). |
| 57 * |
| 58 * - true: basename is a combination of the input file names. |
| 59 * - false: basename is the common prefix of the input file names. |
| 60 * |
| 61 * For example, for: |
| 62 * baselinePath=/tmp/dir/image-before.png |
| 63 * testPath=/tmp/dir/image-after.png |
| 64 * |
| 65 * If setLongNames(true), commonName would be: |
| 66 * image-before-png-vs-image-after-png.png |
| 67 * |
| 68 * If setLongNames(false), commonName would be: |
| 69 * image-.png |
| 70 */ |
| 71 void setLongNames(const bool useLongNames); |
| 72 |
| 73 /** |
55 * 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 |
56 * these. | 75 * these. |
57 * @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 |
58 * themselves. | 77 * themselves. |
59 */ | 78 */ |
60 void setDiffers(const SkTDArray<SkImageDiffer*>& differs); | 79 void setDiffers(const SkTDArray<SkImageDiffer*>& differs); |
61 | 80 |
62 /** | 81 /** |
63 * Compares two directories of images with the given differ | 82 * Compares two directories of images with the given differ |
64 * @param baselinePath The baseline directory's path | 83 * @param baselinePath The baseline directory's path |
(...skipping 13 matching lines...) Expand all Loading... |
78 * @param baselinePath The baseline file path | 97 * @param baselinePath The baseline file path |
79 * @param testPath The matching test file path | 98 * @param testPath The matching test file path |
80 */ | 99 */ |
81 void addDiff(const char* baselinePath, const char* testPath); | 100 void addDiff(const char* baselinePath, const char* testPath); |
82 | 101 |
83 /** | 102 /** |
84 * Output the records of each diff in JSON. | 103 * Output the records of each diff in JSON. |
85 * | 104 * |
86 * 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". |
87 * 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: |
88 * "commonName" : string containing the common prefix of the baseline
Path | 107 * "commonName" : string containing the output filename (basename) |
89 * and testPath filenames | 108 * depending on the value of 'longNames'. |
| 109 * (see 'setLongNames' for an explanation and example)
. |
90 * "baselinePath" : string containing the path to the baseline image | 110 * "baselinePath" : string containing the path to the baseline image |
91 * "testPath" : string containing the path to the test image | 111 * "testPath" : string containing the path to the test image |
92 * "differencePath" : (optional) string containing the path to an alpha | 112 * "differencePath" : (optional) string containing the path to an alpha |
93 * mask of the pixel difference between the baseline | 113 * mask of the pixel difference between the baseline |
94 * and test images | 114 * and test images |
95 * TODO(epoger): consider renaming this "alphaMaskPath
" | 115 * TODO(epoger): consider renaming this "alphaMaskPath
" |
96 * to distinguish from other difference types? | 116 * to distinguish from other difference types? |
97 * "rgbDiffPath" : (optional) string containing the path to a bitmap | 117 * "rgbDiffPath" : (optional) string containing the path to a bitmap |
98 * showing per-channel differences between the | 118 * showing per-channel differences between the |
99 * baseline and test images at each pixel | 119 * baseline and test images at each pixel |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // results. | 190 // results. |
171 SkTLList<DiffRecord> fRecords; | 191 SkTLList<DiffRecord> fRecords; |
172 | 192 |
173 SkImageDiffer** fDiffers; | 193 SkImageDiffer** fDiffers; |
174 int fDifferCount; | 194 int fDifferCount; |
175 int fThreadCount; | 195 int fThreadCount; |
176 | 196 |
177 SkString fAlphaMaskDir; | 197 SkString fAlphaMaskDir; |
178 SkString fRgbDiffDir; | 198 SkString fRgbDiffDir; |
179 SkString fWhiteDiffDir; | 199 SkString fWhiteDiffDir; |
| 200 bool longNames; |
180 }; | 201 }; |
181 | 202 |
182 #endif | 203 #endif |
OLD | NEW |