| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "skdiff.h" | 7 #include "skdiff.h" |
| 8 #include "skdiff_utils.h" | 8 #include "skdiff_utils.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 drp->fComparison.fStatus = DiffResource::kSpecified_Status; | 37 drp->fComparison.fStatus = DiffResource::kSpecified_Status; |
| 38 | 38 |
| 39 SkAutoDataUnref baseFileBits(read_file(drp->fBase.fFullPath.c_str())); | 39 SkAutoDataUnref baseFileBits(read_file(drp->fBase.fFullPath.c_str())); |
| 40 if (baseFileBits) { | 40 if (baseFileBits) { |
| 41 drp->fBase.fStatus = DiffResource::kRead_Status; | 41 drp->fBase.fStatus = DiffResource::kRead_Status; |
| 42 } | 42 } |
| 43 SkAutoDataUnref comparisonFileBits(read_file(drp->fComparison.fFullPath.c_st
r())); | 43 SkAutoDataUnref comparisonFileBits(read_file(drp->fComparison.fFullPath.c_st
r())); |
| 44 if (comparisonFileBits) { | 44 if (comparisonFileBits) { |
| 45 drp->fComparison.fStatus = DiffResource::kRead_Status; | 45 drp->fComparison.fStatus = DiffResource::kRead_Status; |
| 46 } | 46 } |
| 47 if (NULL == baseFileBits || NULL == comparisonFileBits) { | 47 if (nullptr == baseFileBits || nullptr == comparisonFileBits) { |
| 48 if (NULL == baseFileBits) { | 48 if (nullptr == baseFileBits) { |
| 49 drp->fBase.fStatus = DiffResource::kCouldNotRead_Status; | 49 drp->fBase.fStatus = DiffResource::kCouldNotRead_Status; |
| 50 } | 50 } |
| 51 if (NULL == comparisonFileBits) { | 51 if (nullptr == comparisonFileBits) { |
| 52 drp->fComparison.fStatus = DiffResource::kCouldNotRead_Status; | 52 drp->fComparison.fStatus = DiffResource::kCouldNotRead_Status; |
| 53 } | 53 } |
| 54 drp->fResult = DiffRecord::kCouldNotCompare_Result; | 54 drp->fResult = DiffRecord::kCouldNotCompare_Result; |
| 55 return; | 55 return; |
| 56 } | 56 } |
| 57 | 57 |
| 58 if (are_buffers_equal(baseFileBits, comparisonFileBits)) { | 58 if (are_buffers_equal(baseFileBits, comparisonFileBits)) { |
| 59 drp->fResult = DiffRecord::kEqualBits_Result; | 59 drp->fResult = DiffRecord::kEqualBits_Result; |
| 60 return; | 60 return; |
| 61 } | 61 } |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 // Considering the above, skimagediff will consider the contents of a -L par
ameter as | 307 // Considering the above, skimagediff will consider the contents of a -L par
ameter as |
| 308 // <filename>(\t<specifier>)? | 308 // <filename>(\t<specifier>)? |
| 309 SkString outputFile; | 309 SkString outputFile; |
| 310 | 310 |
| 311 if (baseLabel.isEmpty()) { | 311 if (baseLabel.isEmpty()) { |
| 312 baseLabel.set(baseFile); | 312 baseLabel.set(baseFile); |
| 313 outputFile = baseLabel; | 313 outputFile = baseLabel; |
| 314 } else { | 314 } else { |
| 315 const char* baseLabelCstr = baseLabel.c_str(); | 315 const char* baseLabelCstr = baseLabel.c_str(); |
| 316 const char* tab = strchr(baseLabelCstr, '\t'); | 316 const char* tab = strchr(baseLabelCstr, '\t'); |
| 317 if (NULL == tab) { | 317 if (nullptr == tab) { |
| 318 outputFile = baseLabel; | 318 outputFile = baseLabel; |
| 319 } else { | 319 } else { |
| 320 outputFile.set(baseLabelCstr, tab - baseLabelCstr); | 320 outputFile.set(baseLabelCstr, tab - baseLabelCstr); |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 if (comparisonLabel.isEmpty()) { | 323 if (comparisonLabel.isEmpty()) { |
| 324 comparisonLabel.set(comparisonFile); | 324 comparisonLabel.set(comparisonFile); |
| 325 } | 325 } |
| 326 printf("Base: %s\n", baseLabel.c_str()); | 326 printf("Base: %s\n", baseLabel.c_str()); |
| 327 printf("Comparison: %s\n", comparisonLabel.c_str()); | 327 printf("Comparison: %s\n", comparisonLabel.c_str()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 } | 368 } |
| 369 | 369 |
| 370 return num_failing_results; | 370 return num_failing_results; |
| 371 } | 371 } |
| 372 | 372 |
| 373 #if !defined SK_BUILD_FOR_IOS | 373 #if !defined SK_BUILD_FOR_IOS |
| 374 int main(int argc, char * const argv[]) { | 374 int main(int argc, char * const argv[]) { |
| 375 return tool_main(argc, (char**) argv); | 375 return tool_main(argc, (char**) argv); |
| 376 } | 376 } |
| 377 #endif | 377 #endif |
| OLD | NEW |