summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/cpdfsdk_widget.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 9bc18fae04..d4fc5c7900 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -39,6 +39,17 @@
#include "xfa/fxfa/include/xfa_ffwidgethandler.h"
#endif // PDF_ENABLE_XFA
+namespace {
+
+// Convert a FX_ARGB to a FX_COLORREF.
+FX_COLORREF ARGBToColorRef(FX_ARGB argb) {
+ return (((static_cast<uint32_t>(argb) & 0x00FF0000) >> 16) |
+ (static_cast<uint32_t>(argb) & 0x0000FF00) |
+ ((static_cast<uint32_t>(argb) & 0x000000FF) << 16));
+}
+
+} // namespace
+
CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot,
CPDFSDK_PageView* pPageView,
CPDFSDK_InterForm* pInterForm)
@@ -555,16 +566,14 @@ CFX_WideString CPDFSDK_Widget::GetName() const {
FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const {
CPDF_FormControl* pFormCtrl = GetFormControl();
int iColorType = 0;
- color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType));
-
+ color = ARGBToColorRef(pFormCtrl->GetBackgroundColor(iColorType));
return iColorType != COLORTYPE_TRANSPARENT;
}
FX_BOOL CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const {
CPDF_FormControl* pFormCtrl = GetFormControl();
int iColorType = 0;
- color = FX_ARGBTOCOLORREF(pFormCtrl->GetBorderColor(iColorType));
-
+ color = ARGBToColorRef(pFormCtrl->GetBorderColor(iColorType));
return iColorType != COLORTYPE_TRANSPARENT;
}
@@ -577,8 +586,7 @@ FX_BOOL CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const {
FX_ARGB argb;
int iColorType = COLORTYPE_TRANSPARENT;
da.GetColor(argb, iColorType);
- color = FX_ARGBTOCOLORREF(argb);
-
+ color = ARGBToColorRef(argb);
return iColorType != COLORTYPE_TRANSPARENT;
}