Add --reverse-byte-order flag to pdfium_test.

One last rendering flag that is not covered by existing command line
flags.

Bug: pdfium:994
Change-Id: Id6a38fa8a9f7d1721b7ea1f40edafc27c0165393
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/62556
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index f460887..3eb62ca 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -114,6 +114,7 @@
   bool no_smoothtext = false;
   bool no_smoothimage = false;
   bool no_smoothpath = false;
+  bool reverse_byte_order = false;
   bool save_attachments = false;
   bool save_images = false;
   bool save_thumbnails = false;
@@ -163,6 +164,8 @@
     flags |= FPDF_RENDER_NO_SMOOTHIMAGE;
   if (options.no_smoothpath)
     flags |= FPDF_RENDER_NO_SMOOTHPATH;
+  if (options.reverse_byte_order)
+    flags |= FPDF_REVERSE_BYTE_ORDER;
   return flags;
 }
 
@@ -402,6 +405,8 @@
       options->no_smoothimage = true;
     } else if (cur_arg == "--no-smoothpath") {
       options->no_smoothpath = true;
+    } else if (cur_arg == "--reverse-byte-order") {
+      options->reverse_byte_order = true;
     } else if (cur_arg == "--save-attachments") {
       options->save_attachments = true;
     } else if (cur_arg == "--save-images") {
@@ -994,6 +999,8 @@
     "  --no-smoothtext      - render disabling text anti-aliasing\n"
     "  --no-smoothimage     - render disabling image anti-alisasing\n"
     "  --no-smoothpath      - render disabling path anti-aliasing\n"
+    "  --reverse-byte-order - render to BGRA, if supported by the output "
+    "format\n"
     "  --save-attachments   - write embedded attachments "
     "<pdf-name>.attachment.<attachment-name>\n"
     "  --save-images        - write embedded images "