Make "--diff" option handle reverse-byte-order results for pdfium_diff This CL adds the support for running pdfium-diff with the "--diff" option to compare the reverse-byte-order rendering result with the baseline image so that it's easier to see the discrepancies. Bug: pdfium:1955 Change-Id: I8b37975dfc902750722c82768489fefe66dc439b Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/109211 Commit-Queue: Nigi <nigi@chromium.org> Reviewed-by: K. Moon <kmoon@chromium.org>
diff --git a/testing/image_diff/image_diff.cpp b/testing/image_diff/image_diff.cpp index a701921..d48c253 100644 --- a/testing/image_diff/image_diff.cpp +++ b/testing/image_diff/image_diff.cpp
@@ -369,11 +369,17 @@ const std::string& file1, const std::string& file2, const std::string& out_file, - bool do_subtraction) { + bool do_subtraction, + bool reverse_byte_order) { Image actual_image; Image baseline_image; - if (!actual_image.CreateFromFilename(file1)) { + bool actual_load_result = + reverse_byte_order + ? actual_image.CreateFromFilenameWithReverseByteOrder(file1) + : actual_image.CreateFromFilename(file1); + + if (!actual_load_result) { fprintf(stderr, "%s: Unable to open file \"%s\"\n", binary_name.c_str(), file1.c_str()); return kStatusError; @@ -451,7 +457,7 @@ if (produce_diff_image || produce_image_subtraction) { if (!diff_filename.empty()) { return DiffImages(binary_name, filename1, filename2, diff_filename, - produce_image_subtraction); + produce_image_subtraction, reverse_byte_order); } } else if (!filename2.empty()) { return CompareImages(binary_name, filename1, filename2, histograms,