From 72177dadac8f9765440b3aa01e2668f60a8b3f43 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 15 Sep 2016 12:07:23 -0700 Subject: Replace FX_UINT with unsigned int Remove the FX_UINT typedef and update to use the actual unsigned int type. Review-Url: https://codereview.chromium.org/2343693002 --- fpdfsdk/cpdfsdk_widget.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'fpdfsdk/cpdfsdk_widget.cpp') 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(argb) & 0x00FF0000) >> 16) | + (static_cast(argb) & 0x0000FF00) | + ((static_cast(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; } -- cgit v1.2.3