| 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; } |
| 27 |
| 26 /** | 28 /** |
| 27 * Sets the differs to be used in each diff. Already started diffs will not
retroactively use | 29 * Sets the differs to be used in each diff. Already started diffs will not
retroactively use |
| 28 * these. | 30 * these. |
| 29 * @param differs An array of differs to use. The array is copied, but not t
he differs | 31 * @param differs An array of differs to use. The array is copied, but not t
he differs |
| 30 * themselves. | 32 * themselves. |
| 31 */ | 33 */ |
| 32 void setDiffers(const SkTDArray<SkImageDiffer*>& differs); | 34 void setDiffers(const SkTDArray<SkImageDiffer*>& differs); |
| 33 | 35 |
| 34 /** | 36 /** |
| 35 * Compares two directories of images with the given differ | 37 * Compares two directories of images with the given differ |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 99 |
| 98 | 100 |
| 99 private: | 101 private: |
| 100 struct DiffData { | 102 struct DiffData { |
| 101 const char* fDiffName; | 103 const char* fDiffName; |
| 102 double fResult; | 104 double fResult; |
| 103 SkTDArray<SkIPoint> fPointsOfInterest; | 105 SkTDArray<SkIPoint> fPointsOfInterest; |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 struct DiffRecord { | 108 struct DiffRecord { |
| 109 SkString fDifferencePath; |
| 107 SkString fBaselinePath; | 110 SkString fBaselinePath; |
| 108 SkString fTestPath; | 111 SkString fTestPath; |
| 109 SkTArray<DiffData> fDiffs; | 112 SkTArray<DiffData> fDiffs; |
| 110 DiffRecord* fNext; | 113 DiffRecord* fNext; |
| 111 }; | 114 }; |
| 112 | 115 |
| 113 // We use linked list for the records so that their pointers remain stable.
A resizable array | 116 // We use linked list for the records so that their pointers remain stable.
A resizable array |
| 114 // might change its pointers, which would make it harder for async diffs to
record their | 117 // might change its pointers, which would make it harder for async diffs to
record their |
| 115 // results. | 118 // results. |
| 116 DiffRecord * fRecords; | 119 DiffRecord * fRecords; |
| 117 | 120 |
| 118 SkImageDiffer** fDiffers; | 121 SkImageDiffer** fDiffers; |
| 119 int fDifferCount; | 122 int fDifferCount; |
| 123 int fThreadCount; |
| 120 }; | 124 }; |
| 121 | 125 |
| 122 #endif | 126 #endif |
| OLD | NEW |