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 10 matching lines...) Expand all Loading... |
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 Loading... |
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 } |
OLD | NEW |