Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: tools/skpdiff/SkDiffContext.cpp

Issue 27512002: Update skpdiff to include a name with each file. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/skpdiff/viewer.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } else { 160 } else {
161 stream.writeText("{\n"); 161 stream.writeText("{\n");
162 } 162 }
163 stream.writeText(" \"records\": [\n"); 163 stream.writeText(" \"records\": [\n");
164 while (NULL != currentRecord) { 164 while (NULL != currentRecord) {
165 stream.writeText(" {\n"); 165 stream.writeText(" {\n");
166 166
167 SkString baselineAbsPath = get_absolute_path(currentRecord->fBaselin ePath); 167 SkString baselineAbsPath = get_absolute_path(currentRecord->fBaselin ePath);
168 SkString testAbsPath = get_absolute_path(currentRecord->fTestPath); 168 SkString testAbsPath = get_absolute_path(currentRecord->fTestPath);
169 169
170 // strip off directory structure and find the common part of the fil ename
171 SkString baseName = SkOSPath::SkBasename(baselineAbsPath.c_str());
172 SkString testName = SkOSPath::SkBasename(testAbsPath.c_str());
173 for (size_t x = 0; x < baseName.size(); ++x) {
174 if (baseName[x] != testName[x]) {
175 baseName.insertUnichar(x, '\n');
176 break;
177 }
178 }
179
180 stream.writeText(" \"commonName\": \"");
181 stream.writeText(baseName.c_str());
182 stream.writeText("\",\n");
183
170 stream.writeText(" \"baselinePath\": \""); 184 stream.writeText(" \"baselinePath\": \"");
171 stream.writeText(baselineAbsPath.c_str()); 185 stream.writeText(baselineAbsPath.c_str());
172 stream.writeText("\",\n"); 186 stream.writeText("\",\n");
173 187
174 stream.writeText(" \"testPath\": \""); 188 stream.writeText(" \"testPath\": \"");
175 stream.writeText(testAbsPath.c_str()); 189 stream.writeText(testAbsPath.c_str());
176 stream.writeText("\",\n"); 190 stream.writeText("\",\n");
177 191
178 stream.writeText(" \"diffs\": [\n"); 192 stream.writeText(" \"diffs\": [\n");
179 for (int diffIndex = 0; diffIndex < currentRecord->fDiffs.count(); d iffIndex++) { 193 for (int diffIndex = 0; diffIndex < currentRecord->fDiffs.count(); d iffIndex++) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 for (int i = 0; i < cntColumns; i++) { 298 for (int i = 0; i < cntColumns; i++) {
285 SkString str; 299 SkString str;
286 str.printf(", %f", values[i]); 300 str.printf(", %f", values[i]);
287 stream.writeText(str.c_str()); 301 stream.writeText(str.c_str());
288 } 302 }
289 stream.writeText("\n"); 303 stream.writeText("\n");
290 304
291 currentRecord = currentRecord->fNext; 305 currentRecord = currentRecord->fNext;
292 } 306 }
293 } 307 }
OLDNEW
« no previous file with comments | « no previous file | tools/skpdiff/viewer.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698