Chromium Code Reviews| Index: fpdfsdk/cpdfsdk_widget.cpp |
| diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp |
| index 9bc18fae04694628981c91fca0d82f847052afbc..704c7b155e96beb9d0aa64ba49d5de47e39d213f 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. |
|
Tom Sepez
2016/09/15 17:41:21
nit: lose the # in the comment?
dsinclair
2016/09/15 17:45:36
Done.
|
| +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; |
| } |