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 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
10 #include "SkOSFile.h" | 10 #include "SkOSFile.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 void SkDiffContext::diffDirectories(const char baselinePath[], const char testPa
th[]) { | 95 void SkDiffContext::diffDirectories(const char baselinePath[], const char testPa
th[]) { |
96 // Get the files in the baseline, we will then look for those inside the tes
t path | 96 // Get the files in the baseline, we will then look for those inside the tes
t path |
97 SkTArray<SkString> baselineEntries; | 97 SkTArray<SkString> baselineEntries; |
98 if (!get_directory(baselinePath, &baselineEntries)) { | 98 if (!get_directory(baselinePath, &baselineEntries)) { |
99 SkDebugf("Unable to open path \"%s\"\n", baselinePath); | 99 SkDebugf("Unable to open path \"%s\"\n", baselinePath); |
100 return; | 100 return; |
101 } | 101 } |
102 | 102 |
103 for (int baselineIndex = 0; baselineIndex < baselineEntries.count(); baselin
eIndex++) { | 103 for (int baselineIndex = 0; baselineIndex < baselineEntries.count(); baselin
eIndex++) { |
| 104 SkDebugf("[%i/%i] ", baselineIndex, baselineEntries.count()); |
104 const char* baseFilename = baselineEntries[baselineIndex].c_str(); | 105 const char* baseFilename = baselineEntries[baselineIndex].c_str(); |
105 | 106 |
106 // Find the real location of each file to compare | 107 // Find the real location of each file to compare |
107 SkString baselineFile = SkOSPath::SkPathJoin(baselinePath, baseFilename)
; | 108 SkString baselineFile = SkOSPath::SkPathJoin(baselinePath, baseFilename)
; |
108 SkString testFile = SkOSPath::SkPathJoin(testPath, baseFilename); | 109 SkString testFile = SkOSPath::SkPathJoin(testPath, baseFilename); |
109 | 110 |
110 // Check that the test file exists and is a file | 111 // Check that the test file exists and is a file |
111 if (sk_exists(testFile.c_str()) && !sk_isdir(testFile.c_str())) { | 112 if (sk_exists(testFile.c_str()) && !sk_isdir(testFile.c_str())) { |
112 // Queue up the comparison with the differ | 113 // Queue up the comparison with the differ |
113 this->addDiff(baselineFile.c_str(), testFile.c_str()); | 114 this->addDiff(baselineFile.c_str(), testFile.c_str()); |
(...skipping 19 matching lines...) Expand all Loading... |
133 SkDebugf("Unable to get pattern \"%s\"\n", testPattern); | 134 SkDebugf("Unable to get pattern \"%s\"\n", testPattern); |
134 return; | 135 return; |
135 } | 136 } |
136 | 137 |
137 if (baselineEntries.count() != testEntries.count()) { | 138 if (baselineEntries.count() != testEntries.count()) { |
138 SkDebugf("Baseline and test patterns do not yield corresponding number o
f files\n"); | 139 SkDebugf("Baseline and test patterns do not yield corresponding number o
f files\n"); |
139 return; | 140 return; |
140 } | 141 } |
141 | 142 |
142 for (int entryIndex = 0; entryIndex < baselineEntries.count(); entryIndex++)
{ | 143 for (int entryIndex = 0; entryIndex < baselineEntries.count(); entryIndex++)
{ |
| 144 SkDebugf("[%i/%i] ", entryIndex, baselineEntries.count()); |
143 const char* baselineFilename = baselineEntries[entryIndex].c_str(); | 145 const char* baselineFilename = baselineEntries[entryIndex].c_str(); |
144 const char* testFilename = testEntries [entryIndex].c_str(); | 146 const char* testFilename = testEntries [entryIndex].c_str(); |
145 | 147 |
146 this->addDiff(baselineFilename, testFilename); | 148 this->addDiff(baselineFilename, testFilename); |
147 } | 149 } |
148 } | 150 } |
149 | 151 |
150 void SkDiffContext::outputRecords(SkWStream& stream, bool useJSONP) { | 152 void SkDiffContext::outputRecords(SkWStream& stream, bool useJSONP) { |
151 DiffRecord* currentRecord = fRecords; | 153 DiffRecord* currentRecord = fRecords; |
152 if (useJSONP) { | 154 if (useJSONP) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 223 } |
222 stream.writeText(" ]\n"); | 224 stream.writeText(" ]\n"); |
223 if (useJSONP) { | 225 if (useJSONP) { |
224 stream.writeText("};\n"); | 226 stream.writeText("};\n"); |
225 } | 227 } |
226 else | 228 else |
227 { | 229 { |
228 stream.writeText("}\n"); | 230 stream.writeText("}\n"); |
229 } | 231 } |
230 } | 232 } |
OLD | NEW |