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

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

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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
« no previous file with comments | « tools/sk_tool_utils_font.cpp ('k') | tools/skpdiff/SkPMetric.cpp » ('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 10 matching lines...) Expand all
21 #include "SkImageDiffer.h" 21 #include "SkImageDiffer.h"
22 #include "skpdiff_util.h" 22 #include "skpdiff_util.h"
23 23
24 SkDiffContext::SkDiffContext() { 24 SkDiffContext::SkDiffContext() {
25 fDiffers = NULL; 25 fDiffers = NULL;
26 fDifferCount = 0; 26 fDifferCount = 0;
27 } 27 }
28 28
29 SkDiffContext::~SkDiffContext() { 29 SkDiffContext::~SkDiffContext() {
30 if (fDiffers) { 30 if (fDiffers) {
31 SkDELETE_ARRAY(fDiffers); 31 delete[] fDiffers;
32 } 32 }
33 } 33 }
34 34
35 void SkDiffContext::setAlphaMaskDir(const SkString& path) { 35 void SkDiffContext::setAlphaMaskDir(const SkString& path) {
36 if (!path.isEmpty() && sk_mkdir(path.c_str())) { 36 if (!path.isEmpty() && sk_mkdir(path.c_str())) {
37 fAlphaMaskDir = path; 37 fAlphaMaskDir = path;
38 } 38 }
39 } 39 }
40 40
41 void SkDiffContext::setRgbDiffDir(const SkString& path) { 41 void SkDiffContext::setRgbDiffDir(const SkString& path) {
42 if (!path.isEmpty() && sk_mkdir(path.c_str())) { 42 if (!path.isEmpty() && sk_mkdir(path.c_str())) {
43 fRgbDiffDir = path; 43 fRgbDiffDir = path;
44 } 44 }
45 } 45 }
46 46
47 void SkDiffContext::setWhiteDiffDir(const SkString& path) { 47 void SkDiffContext::setWhiteDiffDir(const SkString& path) {
48 if (!path.isEmpty() && sk_mkdir(path.c_str())) { 48 if (!path.isEmpty() && sk_mkdir(path.c_str())) {
49 fWhiteDiffDir = path; 49 fWhiteDiffDir = path;
50 } 50 }
51 } 51 }
52 52
53 void SkDiffContext::setLongNames(const bool useLongNames) { 53 void SkDiffContext::setLongNames(const bool useLongNames) {
54 longNames = useLongNames; 54 longNames = useLongNames;
55 } 55 }
56 56
57 void SkDiffContext::setDiffers(const SkTDArray<SkImageDiffer*>& differs) { 57 void SkDiffContext::setDiffers(const SkTDArray<SkImageDiffer*>& differs) {
58 // Delete whatever the last array of differs was 58 // Delete whatever the last array of differs was
59 if (fDiffers) { 59 if (fDiffers) {
60 SkDELETE_ARRAY(fDiffers); 60 delete[] fDiffers;
61 fDiffers = NULL; 61 fDiffers = NULL;
62 fDifferCount = 0; 62 fDifferCount = 0;
63 } 63 }
64 64
65 // Copy over the new differs 65 // Copy over the new differs
66 fDifferCount = differs.count(); 66 fDifferCount = differs.count();
67 fDiffers = SkNEW_ARRAY(SkImageDiffer*, fDifferCount); 67 fDiffers = new SkImageDiffer* [fDifferCount];
68 differs.copy(fDiffers); 68 differs.copy(fDiffers);
69 } 69 }
70 70
71 static SkString get_common_prefix(const SkString& a, const SkString& b) { 71 static SkString get_common_prefix(const SkString& a, const SkString& b) {
72 const size_t maxPrefixLength = SkTMin(a.size(), b.size()); 72 const size_t maxPrefixLength = SkTMin(a.size(), b.size());
73 SkASSERT(maxPrefixLength > 0); 73 SkASSERT(maxPrefixLength > 0);
74 for (size_t x = 0; x < maxPrefixLength; ++x) { 74 for (size_t x = 0; x < maxPrefixLength; ++x) {
75 if (a[x] != b[x]) { 75 if (a[x] != b[x]) {
76 SkString result; 76 SkString result;
77 result.set(a.c_str(), x); 77 result.set(a.c_str(), x);
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 for (int i = 0; i < cntColumns; i++) { 420 for (int i = 0; i < cntColumns; i++) {
421 SkString str; 421 SkString str;
422 str.printf(", %f", values[i]); 422 str.printf(", %f", values[i]);
423 stream.writeText(str.c_str()); 423 stream.writeText(str.c_str());
424 } 424 }
425 stream.writeText("\n"); 425 stream.writeText("\n");
426 426
427 currentRecord = iter2.next(); 427 currentRecord = iter2.next();
428 } 428 }
429 } 429 }
OLDNEW
« no previous file with comments | « tools/sk_tool_utils_font.cpp ('k') | tools/skpdiff/SkPMetric.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698