Respect FPDF_REVERSE_BYTE_ORDER in FPDF_FFLDraw

Anything drawn using FPDF_FFLDraw passing FPDF_REVERSE_BYTE_ORDER had
red/blue swapped.

Note there's a similar call to pDevice->Attach in FPDF_RenderPage that
likely needs the same fix.

BUG=pdfium:1281

Change-Id: Ic10124c71be59057aa03a05efb4130f8d85d8d60
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/53190
Auto-Submit: Jing Wang <jing@dropbox.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/AUTHORS b/AUTHORS
index f3dfa6a..319351a 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -48,6 +48,7 @@
 
 Collabora Ltd. <*@collabora.co.uk>
 DocsCorp Pty Ltd. <*@docscorp.com>
+Dropbox <*@dropbox.com>
 Foxit Software Inc <*@foxitsoftware.com>
 Google Inc. <*@google.com>
 LG Electronics, Inc. <*@lge.com>
diff --git a/fpdfsdk/fpdf_formfill.cpp b/fpdfsdk/fpdf_formfill.cpp
index 79ea68d..5be70cf 100644
--- a/fpdfsdk/fpdf_formfill.cpp
+++ b/fpdfsdk/fpdf_formfill.cpp
@@ -199,7 +199,7 @@
 #endif
 
   RetainPtr<CFX_DIBitmap> holder(CFXDIBitmapFromFPDFBitmap(bitmap));
-  pDevice->Attach(holder, false, nullptr, false);
+  pDevice->Attach(holder, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false);
   {
     CFX_RenderDevice::StateRestorer restorer(pDevice.get());
     pDevice->SetClip_Rect(rect);
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp
index 96c35b8..d40ee0b 100644
--- a/fpdfsdk/fpdf_formfill_embeddertest.cpp
+++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -843,9 +843,7 @@
 // bitmaps should be different.
 TEST_F(FPDFFormFillEmbedderTest, BUG_1281) {
   const char kMd5Normal[] = "6c674642154408e877d88c6c082d67e9";
-  // TODO(https://crbug.com/pdfium/1281): This should be
-  // 24fff03d1e663b7ece5f6e69ad837124.
-  const char kMd5ReverseByteOrder[] = "6c674642154408e877d88c6c082d67e9";
+  const char kMd5ReverseByteOrder[] = "24fff03d1e663b7ece5f6e69ad837124";
 
   ASSERT_TRUE(OpenDocument("bug_890322.pdf"));
   FPDF_PAGE page = LoadPage(0);