From 92cb5e580cecf0412b74d51e8863ed557e2bd47a Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 16 May 2016 11:38:28 -0700 Subject: Convert border style defines to an enum class. There were two defines, BBS_ and PBS_ for the various border styles in the system. They were the same, except PBS_ had an extra SHADOW define which was never used. This CL combines both of those into a single BorderStyle enum class and updates the code as needed. Also, removes ADDBIT, GETBIT unused defines. Updates barcode code to use the util.h defines instead of redefinition. fsdk_baseannot names starting with _ were cleaned up and some #defines moved to constants. Review-Url: https://codereview.chromium.org/1980973002 --- fpdfsdk/pdfwindow/PWL_Wnd.cpp | 52 +++++++++++++------------------------------ 1 file changed, 16 insertions(+), 36 deletions(-) (limited to 'fpdfsdk/pdfwindow/PWL_Wnd.cpp') diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp index bb424ffa43..310f2f3f90 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -585,11 +585,11 @@ CPWL_Color CPWL_Wnd::GetTextStrokeColor() const { return m_sPrivateParam.sTextStrokeColor; } -int32_t CPWL_Wnd::GetBorderStyle() const { +BorderStyle CPWL_Wnd::GetBorderStyle() const { return m_sPrivateParam.nBorderStyle; } -void CPWL_Wnd::SetBorderStyle(int32_t nBorderStyle) { +void CPWL_Wnd::SetBorderStyle(BorderStyle nBorderStyle) { if (HasFlag(PWS_BORDER)) m_sPrivateParam.nBorderStyle = nBorderStyle; } @@ -819,46 +819,26 @@ IPVT_FontMap* CPWL_Wnd::GetFontMap() const { return m_sPrivateParam.pFontMap; } -CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(int32_t nBorderStyle) const { - CPWL_Color color; - +CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(BorderStyle nBorderStyle) const { switch (nBorderStyle) { - case PBS_SOLID: - break; - case PBS_DASH: - break; - case PBS_BEVELED: - color = CPWL_Color(COLORTYPE_GRAY, 1); - break; - case PBS_INSET: - color = CPWL_Color(COLORTYPE_GRAY, 0.5f); - break; - case PBS_UNDERLINED: - break; + case BorderStyle::BEVELED: + return CPWL_Color(COLORTYPE_GRAY, 1); + case BorderStyle::INSET: + return CPWL_Color(COLORTYPE_GRAY, 0.5f); + default: + return CPWL_Color(); } - - return color; } -CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(int32_t nBorderStyle) const { - CPWL_Color color; - +CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(BorderStyle nBorderStyle) const { switch (nBorderStyle) { - case PBS_SOLID: - break; - case PBS_DASH: - break; - case PBS_BEVELED: - color = CPWL_Utils::DevideColor(GetBackgroundColor(), 2); - break; - case PBS_INSET: - color = CPWL_Color(COLORTYPE_GRAY, 0.75f); - break; - case PBS_UNDERLINED: - break; + case BorderStyle::BEVELED: + return CPWL_Utils::DevideColor(GetBackgroundColor(), 2); + case BorderStyle::INSET: + return CPWL_Color(COLORTYPE_GRAY, 0.75f); + default: + return CPWL_Color(); } - - return color; } int32_t CPWL_Wnd::GetTransparency() { -- cgit v1.2.3