Mark StringToFXARGB() as XFA-only.

Also use ArgbEncode() within it.

Change-Id: Ic3075fa657c8c92d1c78ac4c6a688f6413ecbc12
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79294
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxge/dib/fx_dib.cpp b/core/fxge/dib/fx_dib.cpp
index 76077c3..1f67cd8 100644
--- a/core/fxge/dib/fx_dib.cpp
+++ b/core/fxge/dib/fx_dib.cpp
@@ -80,6 +80,7 @@
                     FXSYS_GetBValue(colorref));
 }
 
+#if defined(PDF_ENABLE_XFA)
 FX_ARGB StringToFXARGB(WideStringView view) {
   static constexpr FX_ARGB kDefaultValue = 0xff000000;
   if (view.IsEmpty())
@@ -130,5 +131,6 @@
       }
     }
   }
-  return (0xffU << 24) | (r << 16) | (g << 8) | b;
+  return ArgbEncode(0xFF, r, g, b);
 }
+#endif  // defined(PDF_ENABLE_XFA)
diff --git a/core/fxge/dib/fx_dib.h b/core/fxge/dib/fx_dib.h
index 78a0c4a..6ea7502 100644
--- a/core/fxge/dib/fx_dib.h
+++ b/core/fxge/dib/fx_dib.h
@@ -13,7 +13,10 @@
 #include <utility>
 
 #include "core/fxcrt/fx_coordinates.h"
+
+#if defined(PDF_ENABLE_XFA)
 #include "core/fxcrt/widestring.h"
+#endif
 
 enum class FXDIB_Format : uint16_t {
   kInvalid = 0,
@@ -129,7 +132,10 @@
 }
 
 FX_ARGB AlphaAndColorRefToArgb(int a, FX_COLORREF colorref);
+
+#if defined(PDF_ENABLE_XFA)
 FX_ARGB StringToFXARGB(WideStringView view);
+#endif
 
 #define FXARGB_A(argb) ((uint8_t)((argb) >> 24))
 #define FXARGB_R(argb) ((uint8_t)((argb) >> 16))