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

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

Issue 646213002: Eliminate one copy of replace_char() function. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: bad... Created 6 years, 1 month 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
« tests/StringTest.cpp ('K') | « tools/skimage_main.cpp ('k') | no next file » | 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 "SkDiffContext.h"
9 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
11 #include "SkImageDiffer.h"
10 #include "SkOSFile.h" 12 #include "SkOSFile.h"
11 #include "SkRunnable.h" 13 #include "SkRunnable.h"
12 #include "SkSize.h" 14 #include "SkSize.h"
13 #include "SkStream.h" 15 #include "SkStream.h"
14 #include "SkTDict.h" 16 #include "SkTDict.h"
15 #include "SkTaskGroup.h" 17 #include "SkTaskGroup.h"
16
17 // from the tools directory for replace_char(...)
18 #include "picture_utils.h"
19
20 #include "SkDiffContext.h"
21 #include "SkImageDiffer.h"
22 #include "skpdiff_util.h" 18 #include "skpdiff_util.h"
23 19
24 SkDiffContext::SkDiffContext() { 20 SkDiffContext::SkDiffContext() {
25 fDiffers = NULL; 21 fDiffers = NULL;
26 fDifferCount = 0; 22 fDifferCount = 0;
27 } 23 }
28 24
29 SkDiffContext::~SkDiffContext() { 25 SkDiffContext::~SkDiffContext() {
30 if (fDiffers) { 26 if (fDiffers) {
31 SkDELETE_ARRAY(fDiffers); 27 SkDELETE_ARRAY(fDiffers);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return a; 80 return a;
85 } 81 }
86 } 82 }
87 83
88 static SkString get_combined_name(const SkString& a, const SkString& b) { 84 static SkString get_combined_name(const SkString& a, const SkString& b) {
89 // Note (stephana): We must keep this function in sync with 85 // Note (stephana): We must keep this function in sync with
90 // getImageDiffRelativeUrl() in static/loader.js (under rebaseline_server). 86 // getImageDiffRelativeUrl() in static/loader.js (under rebaseline_server).
91 SkString result = a; 87 SkString result = a;
92 result.append("-vs-"); 88 result.append("-vs-");
93 result.append(b); 89 result.append(b);
94 sk_tools::replace_char(&result, '.', '_'); 90 result.replace('.', '_');
95 return result; 91 return result;
96 } 92 }
97 93
98 void SkDiffContext::addDiff(const char* baselinePath, const char* testPath) { 94 void SkDiffContext::addDiff(const char* baselinePath, const char* testPath) {
99 // Load the images at the paths 95 // Load the images at the paths
100 SkBitmap baselineBitmap; 96 SkBitmap baselineBitmap;
101 SkBitmap testBitmap; 97 SkBitmap testBitmap;
102 if (!SkImageDecoder::DecodeFile(baselinePath, &baselineBitmap)) { 98 if (!SkImageDecoder::DecodeFile(baselinePath, &baselineBitmap)) {
103 SkDebugf("Failed to load bitmap \"%s\"\n", baselinePath); 99 SkDebugf("Failed to load bitmap \"%s\"\n", baselinePath);
104 return; 100 return;
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 for (int i = 0; i < cntColumns; i++) { 448 for (int i = 0; i < cntColumns; i++) {
453 SkString str; 449 SkString str;
454 str.printf(", %f", values[i]); 450 str.printf(", %f", values[i]);
455 stream.writeText(str.c_str()); 451 stream.writeText(str.c_str());
456 } 452 }
457 stream.writeText("\n"); 453 stream.writeText("\n");
458 454
459 currentRecord = iter2.next(); 455 currentRecord = iter2.next();
460 } 456 }
461 } 457 }
OLDNEW
« tests/StringTest.cpp ('K') | « tools/skimage_main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698