| 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" |
| 11 #include "SkImageDecoder.h" | |
| 12 #include "SkImageEncoder.h" | 11 #include "SkImageEncoder.h" |
| 13 #include "SkOSFile.h" | 12 #include "SkOSFile.h" |
| 14 #include "SkTDArray.h" | 13 #include "SkTDArray.h" |
| 15 #include "SkTemplates.h" | 14 #include "SkTemplates.h" |
| 16 #include "SkTypes.h" | 15 #include "SkTypes.h" |
| 17 | 16 |
| 18 #include <stdio.h> | 17 #include <stdio.h> |
| 19 | 18 |
| 20 /// If outputDir.isEmpty(), don't write out diff files. | 19 /// If outputDir.isEmpty(), don't write out diff files. |
| 21 static void create_diff_images (DiffMetricProc dmp, | 20 static void create_diff_images (DiffMetricProc dmp, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 52 } |
| 54 drp->fResult = DiffRecord::kCouldNotCompare_Result; | 53 drp->fResult = DiffRecord::kCouldNotCompare_Result; |
| 55 return; | 54 return; |
| 56 } | 55 } |
| 57 | 56 |
| 58 if (are_buffers_equal(baseFileBits, comparisonFileBits)) { | 57 if (are_buffers_equal(baseFileBits, comparisonFileBits)) { |
| 59 drp->fResult = DiffRecord::kEqualBits_Result; | 58 drp->fResult = DiffRecord::kEqualBits_Result; |
| 60 return; | 59 return; |
| 61 } | 60 } |
| 62 | 61 |
| 63 get_bitmap(baseFileBits, drp->fBase, SkImageDecoder::kDecodePixels_Mode); | 62 get_bitmap(baseFileBits, drp->fBase, false); |
| 64 get_bitmap(comparisonFileBits, drp->fComparison, SkImageDecoder::kDecodePixe
ls_Mode); | 63 get_bitmap(comparisonFileBits, drp->fComparison, false); |
| 65 if (DiffResource::kDecoded_Status != drp->fBase.fStatus || | 64 if (DiffResource::kDecoded_Status != drp->fBase.fStatus || |
| 66 DiffResource::kDecoded_Status != drp->fComparison.fStatus) | 65 DiffResource::kDecoded_Status != drp->fComparison.fStatus) |
| 67 { | 66 { |
| 68 drp->fResult = DiffRecord::kCouldNotCompare_Result; | 67 drp->fResult = DiffRecord::kCouldNotCompare_Result; |
| 69 return; | 68 return; |
| 70 } | 69 } |
| 71 | 70 |
| 72 create_and_write_diff_image(drp, dmp, colorThreshold, outputDir, outputFilen
ame); | 71 create_and_write_diff_image(drp, dmp, colorThreshold, outputDir, outputFilen
ame); |
| 73 //TODO: copy fBase.fFilename and fComparison.fFilename to outputDir | 72 //TODO: copy fBase.fFilename and fComparison.fFilename to outputDir |
| 74 // svn and git often present tmp files to diff tools which are promptly
deleted | 73 // svn and git often present tmp files to diff tools which are promptly
deleted |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 } | 367 } |
| 369 | 368 |
| 370 return num_failing_results; | 369 return num_failing_results; |
| 371 } | 370 } |
| 372 | 371 |
| 373 #if !defined SK_BUILD_FOR_IOS | 372 #if !defined SK_BUILD_FOR_IOS |
| 374 int main(int argc, char * const argv[]) { | 373 int main(int argc, char * const argv[]) { |
| 375 return tool_main(argc, (char**) argv); | 374 return tool_main(argc, (char**) argv); |
| 376 } | 375 } |
| 377 #endif | 376 #endif |
| OLD | NEW |